jquery - How to select all content between two of the same tags? -
, but I'm looking for a jQuery solution using HTML only below (i.e. no classes or id attributes):
& lt; H2 & gt; Foo & lt; / H2 & gt; & Lt; P & gt; Asdf & lt; / P & gt; & Lt; Ul & gt; & Lt; Li & gt; Asdf & lt; / Li & gt; & Lt; / Ul & gt; & Lt; P & gt; Asdf & lt; / P & gt; & Lt; H2 & gt; Bar & lt; / H2 & gt; & Lt; P & gt; Asdf & lt; / P & gt; & Lt; P & gt; Asdf & lt; / P & gt; & Lt; H2 & gt; Hail & lt; / H2 & gt; & Lt; P & gt; Asdf & lt; / P & gt; & Lt; P & gt; Asdf & lt; / P & gt;
I would like to use some jQuery such as:
$ ('h2'). AfterButforeNext ('h2'). DoSomething ();
This should:
- Select all the Brother elements after the specified element, but before the next occurrence of the specified element.
- If there is no end element, then select all the elements below it.
The previous selector should be able to:
< Code> $ ("h2 ~ *: no (h2)"). DoSomething ();
You only need some type of ID or attribute to select only one H2 element.
Comments
Post a Comment