Javascript examples for jQuery Selector:id
JQUERY get id name from dynamic div
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-1.5.2.js"></script> <script type="text/javascript"> $(window).load(function(){// w w w . ja v a 2 s . co m $('.myclass').click(function(){ console.log($(this).attr("id")); }); }); </script> </head> <body> <div id="x" class="myclass"> DIV 1 </div> <div id="y" class="myclass"> DIV 2 </div> </body> </html>