For example, the following html code
< ;li class="aaaa" title="ttt">li-1
- li-2
- li-2
li-1
li-2
li-2
No. A method of selecting E[@attr] $("[@title]").click().........
that is, selecting all elements based on attributes The element with title attribute
is
li-1 li- 2 li-1
li-2
$("div[@title]").click()..........
Select all elements with title under all div tags
That is,
li-1
li-2
The second method is to select E[@attr=val] $("div[@title=ttt]").click()... ...........
Select all elements under the div whose title attribute is equal to ttt
i.e.
li- 1
If it is $("[@title=ttt]").click()............
All elements with attribute title equal to ttt
li-1 li-1
The third method is to select E[@attr^=val] based on the starting letter of the attribute value.
$("div[@title^=t]" ).click()............
All attribute title values under all div elements are elements starting with t
The third method is to select E[@attr$=val] based on the starting letter of the attribute value.
$("div[@title$=t]").click()......... .......
All attribute title values under all div elements are elements ending with t
The third method is to select E[@attr*=val based on the attribute value containing letters. ]
$("div[@title*=t]").click()............
Under all div elements The value of all attributes title is all elements containing t
The third option is to select E[@attr=val][@attr=val] based on multiple attributes
$ ("div[@title=ttt][@class=aaaa]").click()............
All attributes title under all div elements The value is an element
whose value is equal to ttt and whose attribute class is equal to aaaa