Last active
December 18, 2016 21:54
-
-
Save dryliketoast/1352360 to your computer and use it in GitHub Desktop.
html5 howto: pass args from markup to jquery using "data-" attribute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTML5: | |
<a class="clicker" data-mynumber="311">Click</a> | |
JQUERY: | |
$('.clicker').attr('data-mynumber'); | |
// returns 311 | |
$('.clicker').data('mynumber'); | |
// returns 311 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment