1 Get the element
html from the collection with the specified serial number:
JS
2 Get elements with consistent specified conditions and specified range
html:
JS
3 Get elements consistent with the conditional expression
html:
js
4 Get the previous element and next element of the element
Html:
No. 1
No. 2
No. 3
No. 4
No. 5
No. 6
No. 7< /p>
js
//Get the next element of the element
jQuery(function(){
$("p").next(".yes").css("color", "red");
})
//Get the previous element of the element
jQuery(function(){
$("p").prev(".yes").css( "color","red");
})
5 Get the parent element and child element of the element
html:
No. 1
No. 2
No. 3
No. 4
No. 5
No. 6
No. 7
js
//Get the parent element of the element
jQuery( function(){
$("p").parent().css("color","red");
})
//Get the child elements of the element
jQuery(function (){
$("#aa").children(".yes").css("color","red");
})
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