Javascript examples for jQuery:Tag Traversing
Get id of textarea using type selector
<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 va2s .c om var catId = $("textarea:visible").attr('id'); catId = catId.replace('text_lp', ''); console.log(catId); }); </script> </head> <body> <textarea type="text" id="text_lp1"></textarea> </body> </html>