Set textarea placeholder text - Javascript jQuery

Javascript examples for jQuery:Form Textarea

Description

Set textarea placeholder text

Demo Code

ResultView the demo in separate window

<html>
 <head> 
  <meta name="viewport" content="width=device-width, initial-scale=1"> 
  <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
  <script type="text/javascript">
    $(window).on('load', function() {
$('button').click(function () {
    $('textarea').val('').attr("placeholder", "Type your answer here");
});/*from  ww w  . j a  v  a2  s  .c om*/
    });

      </script> 
 </head> 
 <body> 
  <textarea placeholder="aaa"></textarea> 
  <button>Click me</button>  
 </body>
</html>

Related Tutorials