This is my jQuery code:
$('input[name="Search"]').blur(function(e) {
$(this).text('');
});
And my HTML snippet:
<input name="Search" type="text" id="Search" class="MainMenu" />
But it doesn’t work, does anybody know why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You are using
text()on input typetext which is not defined for input type=text. You need to useval()Live Demo
If you have id, you can use id as it will be more efficient then getting element with name selector.
Live Demo