The jquery hierarchy selector includes siblings and nextAll. This article describes how to use it. For more information, see. I hope to help you with the HTML code:
The Code is as follows:
1
2
2_1
2_1_1
2_2
3
4
$ (". One p" ).css ("background", "red") // All DIV descendant elements after. one (descendant: son and grandson .....)
$ (". One> p" ).css ("background", "red") // subelement after. one. (Son: son and daughter ....)
$ (". One + p" ).css ("background", "red") // adjacent elements after. one. It is the sibling element after. one. Only one
$ (". One" character .next(character .css ("background", "red") // This function is the same
$ (". One ~ P "background .css (" background "," red ") // sibling element after. one. Excluding the previous
$ (". One" ).nextAll().css ("background", "red") // same as above
$ (". One" ).siblings().css ("background", "red") // all the sibling elements of. one, either behind or before.