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" seq='1'>A</a></li> <li><a href="#preclose4" seq='2'>B</a></li> 5 Answers
Like this:
alert($(this).attr('seq'));Although it may be better to put seq as another data element:
<li><a href="#preclose4" data-seq='1'>A</a></li>So then you can do:
alert($(this).data('seq'));2
Have you tried: $(this).attr()?
try the following
$('a.preActNav').click(function() { alert($(this).attr('seq'));
});you need to use $(this) jquery selector instead
Try this
$('a.preActNav').click(function() { alert($(this).attr('seq')); //To get href alert(this.href); }); you can either use this code:
$('.item').click(function(){ console.log($(this).attr("name")); });or
$('.item').on('click', () => { console.log($(".item.active").attr("name"));
});