How can I read href using jquery

I want to read Href on a page using jQuery.

For refrence only: I have a random number of hyperlinks on the page for each user, and all hrefs are different from each other by identifier. user_1, user_2, .... therefore, here they were not able to call the function of the onclick event using JQuery, since each href has a different name and cannot also write separate jquery functions that are different for each user. therefore, if I could count the hrefs on the page, I could easily call the function

The reply is in process

Thanks Mukesh

+3
source share
3 answers

A, AREA, BASE LINK href:

$('a[href], area[href], base[href], link[href]').size()

href. , .

+7

$('[href]'). length? (84 , 88, ?: P)

+3

I am not a js / jquery expert .. but should be able to return an array of tags "a" with

$ ("a")?

+1
source

Source: https://habr.com/ru/post/1718887/


All Articles