jquery click & get value of attributes of a href

Viewed 56972

How can I access seq value in a href, when I click thye link?

/* Add a listner to Group buttons */
    $('a.preActNav').click(function() { 
        alert(this.seq)
    });   



    <li><a href="#preclose4" data-theme="a" data-icon="arrow-d" data-transition="none" seq='1' class="preActNav"  ID="preActNavA">A</a></li>
    <li><a href="#preclose4" data-theme="a" data-icon="arrow-d" data-transition="none" seq='2' class="preActNav"  ID="preActNavB">B</a></li>
5 Answers

you can either use this code:

 $('.item').click(function(){

        console.log($(this).attr("name"));

    });

or

$('.item').on('click', () => {

    console.log($(".item.active").attr("name"));

});
Related