/ Published in: jQuery
First value takes empty input values and adds 'Enter Value'. Second snippet removes 'Enter Value' when input is focused. Third snippet re-adds 'Enter Value' if the value is left blank.
Expand |
Embed | Plain Text
$(function(){ $('input[type="text"]').each(function(){ if(this.value==''){this.value='Enter Value'} }); $('input[type="text"]').focus(function(){ if(this.value=='Enter Value'){this.value=''} }); $('input[type="text"]').blur(function(){ if(this.value==''){this.value='Enter Value'} }); });
You need to login to post a comment.
