Javascript examples for jQuery Selector:id
Get value of id in an element
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript" src="https://code.jquery.com/jquery-3.1.0.min.js"></script> <script type="text/javascript"> window.onload=function(){// w w w . ja va 2 s.c om $(".someClass").click(function(){ var id = $(this).attr("id"); var cls = this.className; console.log(id); console.log(cls); }); } </script> </head> <body> <div class="someClass" id="edi"> afasdfas </div> </body> </html>