Textbox style as watermark image in html

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js" type="text/javascript"></script> 
<style type="text/css">
.UsernameCss { color:#9B9B9B; }
</style>
<script type="text/javascript">
$("txtUserName").addClass("UsernameCss").val("Username")
.focus(function(){ if($(this).val() == "Username") { $(this).removeClass("UsernameCss").val(""); } })
.blur(function(){ if($(this).val() == "") { $(this).val("Search").addClass("UsernameCss"); } });
</script>
</head>
<body><input id="txtUserName" name="txtUserName" type="text" />
</body>
</html>

Tag: css, input, jquery, jquery watermark for textbox, textbox, watermark 

Comments

Popular posts from this blog

Create Desktop Application with PHP

Check no.of vowels in javascript and html

How to Create Image Swap Effect using CSS