Given a jQuery element, how do I determine if the sibling on the right is node text and not another element? In PHP, you would compare nodeType
with #text
- which is equivalent in this case?
window.jQuery('body').find('a').each(function (i) { if(window.jQuery(this).next() == '?'){ } });
I am trying to figure out what I can add to the state.
Update
if(window.jQuery(this).next().length != 0){ alert(window.jQuery(this).next().get(0).nodeType); if(window.jQuery(this).next().get(0).nodeType == 3){ alert('right has text'); }
For some reason, all my tests keep returning 1, not 3, to indicate text nodes!
source share