Get id from first textarea inside form - Javascript jQuery

Javascript examples for jQuery:Form Textarea

Description

Get id from first textarea inside form

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.10.1.js"></script> 
  <script type="text/javascript">
    $(window).load(function(){/*from  www  . j  a  v a  2  s  .com*/
console.log($('form textarea').attr('id'))
    });

      </script> 
 </head> 
 <body> 
  <form> 
   <input> 
   <textarea id="1"></textarea> 
   <div> 
    <textarea id="2"></textarea> 
    <input> 
   </div> 
  </form>  
 </body>
</html>

Related Tutorials