jQuery input placeholder

by Silambarasan_sundaram

HTML

<input id="email" name="email" type="text" value="Write your email here" />

JavaScript

$('#email')
  .on('focus', function(){
      var $this = $(this);
      if($this.val() == 'Write your email here'){
          $this.val('');
      }
  })
  .on('blur', function(){
      var $this = $(this);
      if($this.val() == ''){
          $this.val('Write your email here');
      }
  });