Jquery custom attribute

From John Freier
Revision as of 10:47, 11 August 2011 by Jfreier (Talk | contribs) (Created page with 'Use a custom attribute on an HTML tag and manipulate it in JQuery. <script> $(document).ready(function() { $('a').click(function() { var id = $(this).attr('g…')

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Use a custom attribute on an HTML tag and manipulate it in JQuery.


<script>
$(document).ready(function() {
     $('a').click(function() {
          var id = $(this).attr('goto');
          alert(id);
     });
});
</script>

<a href="#" goto="8">Click Here</a>