We Recommend

Pro JavaScript Techniques Pro JavaScript Techniques
Pro JavaScript Techniques is the ultimate JavaScript book for the modern web developer. It provides everything you need to know about modern JavaScript, and shows what JavaScript can do for your web sites. This book doesn't waste any time looking at things you already know, like basic syntax and structures.


Posted By

hellolabs on 09/19/07


Tagged

inputbox


Versions (?)


Who likes this?

8 people have marked this snippet as a favorite

luman
bartekk
francisre
cwoodley
vali29
yetanother
blackabee
korzhik


JQuery: onclick inputbox clear


Published in: JavaScript 


('#filterbox') = inputbox identifier (this.value==' enter text to filter candidates') = default-state text this.value=' ' = onclick-state text

  1. // onclick inputbox clear
  2.  
  3. $(document).ready(function(){
  4.  
  5. $('#filterbox').focus(function(){
  6. if(this.value==' enter text to filter candidates')
  7. {
  8. this.value=' '
  9. }
  10. });
  11.  
  12. });

Report this snippet 

You need to login to post a comment.