CHAPTER 1
■
INTRODUCING JQUERY
15
$(".foo+p");
There is only one element with the class
foo, so only one paragraph element is returned:
>>> $('.foo+p');
[ p ]
Next, use a more general query, and select the next paragraph element after any paragraph element:
$('p+p');
There are four paragraphs in our markup, and all of them but the last have a
next paragraph, so the
console will display three elements in the result:
Do'stlaringiz bilan baham: