Posted By

jeppeb on 06/10/08


Tagged

form Value cleaner


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

wizard04
korzhik


Form value 'cleaner'


 / Published in: JavaScript
 

When there's a value in a textbox, like 'search', it disappears when you click on it, and reappears when you leave (blur) it. But only if you haven't filled in anything ofcourse. Use it like this:

  1. function clean(element, what){
  2. value = element.value;
  3. if(value==what)element.value="";
  4. if(value=="")element.value=what;
  5. }

Report this snippet  

You need to login to post a comment.