I am quite new to JQuery.
I would like to get the value of an anchor from a href with JQuery.
If I'd have the following example, how could i get the value "5" from the href with JQuery?
<a href="user/showUsers#5">User 5</a>
Thanks in advance
-James
Use the following:
var id = $('a').attr('href').split('#');
id = id[id.length - 1];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With