jQuery .next() and .prev() not working as they should!
- by Luca Matteis
I want to get the .next() and .prev() sibling of an HTML element without excluding TextNodes.
I basically need to understand if an element is directly sorrounded by <br> HTML elements.
This would return true:
<br>
<div></div>
<br>
This would return false:
<br>
Some text
<div></div>
<br>
BUT this needs to also return true:
<br>
<div></div>
<br>
The third example basically uses an empty TextNode, or blankspaces, or newlines.
What's the best way to do this?