Use $(this) for textarea - Javascript jQuery

Javascript examples for jQuery:Form Textarea

Description

Use $(this) for textarea

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-1.4.2.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*w  w w .  j ava 2s.c o m*/
$("textarea").click(function() {
    if ($(this).text() === "Something") {
        $(this).text("");
    }
});
    });

      </script> 
   </head> 
   <body> 
      <textarea>Something</textarea>  
   </body>
</html>

Related Tutorials