Home >Web Front-end >JS Tutorial >Implementation code for selecting hyperlinks in JQuery_jquery

Implementation code for selecting hyperlinks in JQuery_jquery

WBOY
WBOYOriginal
2016-05-16 18:06:401046browse

The grammatical rules are as follows:

$('a[href$="ABC"]')...

supports the following selection methods:

= The judgment is completely consistent;

!= does not match;

^=begins with a certain string;

$=ends with a certain string;

*=contains a certain character string.

Further, you can return the first record in the result set through $('a[href$="ABC"]:first')

If you need to traverse the result set:

Copy code The code is as follows:

$('a[href*=/Lists/Booking/ DispForm.aspx]').each(function(){
// $(this)…
});



If you want to get related attributes, you can Get

through $('a[href$="ABC"]:first').attr('title'), etc. If you need to return the text in the hyperlink, you can use $(this).html ()
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn