I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?
I had the same problem and solved it with:
Code:
$.fn.nextNode = function(){ var contents = $(this).parent().contents(); return contents.get(contents.index(this)+1); }
Usage:
$('#my_id').nextNode();
Is like next() but also returns the text nodes.
next()