Question and answer is powered by AnsPress.io
If my button like
<button type="button" name="Create" id="Create" data-id="2">Create</button>
I want to get data-id value while click on button. How can I get button data attribute in jQuery.
To get attribute value apply this code.
$(document).on('click', '#Create', function(e){ var id = $(this).data("id"); });