I have some text in the following div: .wpbdp-listing-single
The text has nothing wrapping it. How to trap an HTML tag around it? (without wrapping the other elements that do have html tags?
I have some text in the following div: .wpbdp-listing-single The text has nothing wrapping
Share
So you want to only wrap text-only elements of that div. Here’s jQuery code that does that:
Unlike
.children(),.contents()will return text nodes as well, and you can filter for text nodes only by testing for thenodeTypeproperty.Fiddle: http://jsfiddle.net/dandv/YkgLa/