Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<meta charset=utf-8 />
<title>JS Bin</title>
</head>
<body>
  
  
<form action="" method="">
  
  <textarea></textarea>
  <br>
  <input type="submit" />
    
</form>
  
  
</body>
</html>
 
textarea{
  border-radius:4px;
  border:1px solid #eee;
  padding:15px;
  font-family:Helvetica;
}
 
jQuery(function($) {
  
  var $txtA = $("textarea");
  var emailDef = "Please enter your email content here...";
  
  $txtA.val(emailDef);
  
  $txtA.focusout(function() {
     if ($.trim(this.value) === "") {
         this.value = emailDef;
     }
  });
  
  $txtA.focus(function() {
     if( this.value === emailDef ) {
         this.value="";
     }
  });
  
  $('form').submit(function(){
    var txtAval = $txtA[0].value;
    if(txtAval==emailDef || !$.trim(txtAval)){
      alert("Missing your email!");
      return false;
    }
  });
    
});
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers