Like the following HTML code
Copy Code code as follows:
<ul>
<li class= "AAAA" title= "TTT" >li-1</li>
<li class= "BBBB" >li-2</li>
<li title= "FFFFF" >li-2</li>
</ul>
<div class= "AAAA" title= "TTT" >li-1</div>
<div class= "BBBB" >li-2</div>
<div title= "FFFFF" >li-2</div>
The first is to select E[@attr] based on the attribute
$ ("[@title]"). Click () ...
That is, select elements within all elements with title
That
<li class= "AAAA" title= "TTT" >li-1</li>
<li title= "FFFFF" >li-2</li>
<div class= "AAAA" title= "TTT" >li-1</div>
<div title= "FFFFF" >li-2</div>
$ ("div[@title]"). Click () ...
Select all the element with title under All div tags
That
<div class= "AAAA" title= "TTT" >li-1</div>
<div title= "FFFFF" >li-2</div>
The second chooses e[@attr =val] based on the value of the attribute .
$ ("div[@title =ttt]"). Click () .......
Select all the title attributes under div equal to TTT elements
That
<div class= "AAAA" title= "TTT" >li-1</div>
If it is $ ("[@title =ttt]"). Click () ......
element with title equal to TTT under all elements
<li class= "AAAA" title= "TTT" >li-1</li>
<div class= "AAAA" title= "TTT" >li-1</div>
The third type selects e[@attr ^=val] based on the value of the attribute.
$ ("div[@title ^=t]"). Click () .......
All the attribute title values under all DIV elements are elements that start with T
The third type selects e[@attr $=val] based on the value of the attribute.
$ ("div[@title $=t]"). Click () .......
All the attribute title values under all DIV elements are elements that end with T
The third includes the letter selection based on the attribute value e[@attr *=val]
$ ("div[@title *=t]"). Click () .......
All the attribute title values under all DIV elements are all elements that contain t
The third option is to select e[@attr =val][@attr =val] based on multiple attributes.
$ ("div[@title =ttt][@class =aaaa]"). Click () .......
All attribute title values under all DIV elements are equal to TTT and attribute class equals AAAA elements