Javascript examples for jQuery Method and Property:attr
Show element attribute on click event
<html lang="en"> <head> <title> UIDesigner</title> </head> /* w w w .jav a2 s . co m*/ <body translate="no"> <div class="fullkey"> <div data-keyid="c-key"> Click Here </div> </div> <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script> <script> $('.fullkey div').click( function (){ var keyId = $(this).attr('data-keyid'); console.log(keyId); }); </script> </body> </html>