The siblings method in jQuery
Using the method siblings you can find all the neighbors of an element. Let's look at the HTML code:
html<p>text</p>
<p>text</p>
<p id="test">text</p>
<p>text</p>
<p>text</p>
Then we apply the method siblings:
javascript$('#test').siblings().html('!');
By passing a selector to the method, you can perform additional filtering of neighbors, for example like this:
javascript$(#test).siblings('.zzz').html('!');
Задание 1
Find all neighbors of li with class www.
Задание 2
Find all neighbors of li with class www that (neighbors) have class test.
Задание 3
Find all neighbors of li with class www, but NOT a neighbor with class test.