JQuery Tutorial 25 - Advanced Attribute Selector with an example






Code
<html lang="en">
<head>
 <title>JQueryexamplecode.blogspot.com</title>
   <script src="js/jquery.js" type="text/javascript"></script>
</head>
<body>
 Name: <input id="txtName" type="text" /> 

 email: <input id="txtEmail" size="40" type="email" />

 Confirm Email <input id="txtConfirmEmail" size="40" type="email" />
 <script>
  var warterMarkEmail="Please enter email address...";
  $('input[type="email"]').attr('value',warterMarkEmail).focus(function(){
   if($(this).val()==warterMarkEmail){
    $(this).attr('value',"");
   }
  }).blur(function(){
   if($(this).val()==""){
    $(this).attr('value',warterMarkEmail);
    $(this).css('background-color',"red");
   }
  })
  
 </script>
</body>
</html>




Output
Share this post :

Post a Comment

Please give your valuable feedback on this post. You can submit any ASP.NET article here. We will post that article in this website by your name.

 
Support : Ranga Rajesh Kumar
Copyright © 2012. ASP.NET Examples - All Rights Reserved
Site Designed by Ranga Rajesh Kumar