Skip to content

Instantly share code, notes, and snippets.

@dryliketoast
Last active December 18, 2016 21:54
Show Gist options
  • Save dryliketoast/1352360 to your computer and use it in GitHub Desktop.
Save dryliketoast/1352360 to your computer and use it in GitHub Desktop.
html5 howto: pass args from markup to jquery using "data-" attribute
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