How do I select text nodes with jQuery?
jQuery doesn’t have a convenient function for this. You need to combine contents(), which will give just child nodes but includes text nodes, with find(), which gives all descendant elements but no text nodes. Here’s what I’ve come up with: Note: If you’re using jQuery 1.7 or earlier, the code above will not work. To fix this, … Read more