php - Default text must disappear in textarea upon click using jQuery

Solution:
First off you are mixing upPHP
code withJavaScript
code which will not work, since they are in no direct relation.
Secondly you have to put yourfocus / blur -listeners
in thedocument ready
function (this means it will load when the document is loaded).
Thirdly I highly recommend to read some about the basics of jQuery - you could start with this: http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery
Edit: Since you really seem to be very confused about everything, here a full example:
<html>
<head>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
var defaultMessage = "default message";
$("#myTextArea").focus(function(){
if( $(this).val() == defaultMessage){
$(this).val("");
}
}).blur(function(){
if( $(this).val() == "" ){
$(this).val(defaultMessage);
}
}).val(defaultMessage);
});
</script>
</head>
<body>
<textarea id="myTextArea"></textarea>
</body>
</html>
In the example above you can also see that I use a newer jQuery-Version - directly from their servers.
Viewing the other answer of Chandrakant:
I don't agree putting the JavaScript part directly into the element. It's not a good practice, since you should always try to split logic & formatting.
Answer
Solution:
No need to use jQuery for this , If still you are interested to use jQuery- then use following logic
<input type="text" value="your text" onfocus="if (this.value == 'your text') {this.value = '';}" onblur="if (this.value == '') {this.value = 'your text';}">
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: an exception occurred in the driver: could not find driver
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.