javascript: Checking if tags are next to each other
- by user3731759
So here is the problem: I want to check if element <x-statement> is right next to <p> and there is no text in between them.
So this will return true:
<div>
<x-statement>[discover.prev]</x-statement>
<p>Go forward<p>
</div>
But this won't:
<div>
<x-statement>[discover.prev]</x-statement>
im in the way herr der
<p>Go forward<p>
</div>
This what I've tried to do:
if($(this).next().is('p')){
alert("p is next to you");
}