Possible Duplicate:
jquery – How to select all content between two tags
Suppose I have some HTML, e.g.:
<div>
<span>
<a>Link</a>
</span>
<p id="start">Foo</p>
<!-- loads of HTML goes here -->
<img src="bar.png" />
<form id="end">
<input type="text" />
</form>
</div>
Now suppose I want to select everything between the <p> and the </form>, and put it into a string. How would I do that (note that I won’t necessarily know what is between the 2 tags? JQuery answers are welcome.
just use nextUntil() gets immediate sibling until the given selector