I'm trying (in native Javascript, so without jQuery or anything) to get content before and after occurence of a div.
HTML:
<div id="thisIsWhatIWant">
<span>foo</span>
<div id="helloWorld">hello world</div>
<p>bar</p>
</div>
So I want to get <span>foo</span>
and <p>bar</p>
in separate vars.
JS:
var beforeElement_helloWorld = ...do something to get <span>foo</span>...
var afterElement_helloWorld = ...do something to get <p>bar</p>...
note:
There may be many more divs, spans etc in the HTML example.
bar
in separate vars." – Bob van Luijt Feb 24 '15 at 01:43