Learn free online HTML5, javascript, and jquery Tutorials by Examples

Saturday, 3 January 2015

On focus Clear input filed value using javascript

<input type="text" onblur="unblank(this)" onfocus="blank(this)" value="Email Address">

<script>
 function blank(a) {
if(a.value==a.defaultValue)a.value="";
}
 function unblank(a) {
if(a.value=="")a.value=a.defaultValue;
}

</script>

No comments:

Post a Comment