Remove the .not("[nodeType=1]"). It's the anchor that is being wrapped, not 'John'.
On Fri, Feb 20, 2009 at 9:11 AM, David <david.kar...@gmail.com> wrote: > > According to the documentation, .contents() should "Find all the child > nodes inside the matched elements (including text nodes)". However, > in the example given there, when the jquery > $("p").contents().not("[nodeType=1]").wrap("<b/>") > is applied to the content > <p>Hello <a href="http://ejohn.org/">John</a>, how are you doing?</ > p> > only the text "John" is made bold---in other words, jquery is failing > to select the text nodes containing "Hello" and ", how are you doing" > > Since I would very much like to be able to select the text nodes, can > someone explain what is going on here? > > Thanks > David >