jQuery is string styled

Hi friends. Let’s say you search for a string of text in your HTML. I have also consider there may be multiple occurrences of the same string. I would like to know can jQuery be used to tell if this string is styled. What I mean by styled is color and <em>, <strong>, <span> tag wrapped around it. I do not need to worry about external styles. What I would want to do at that point is remove the style. If there are multiple of course I want to remove it from all of them. If possible an example would be appreciated. Thanks

You can use :contains() or better use .filter(). Check out this stackoverflow article which will help you out. Essentially you search a parent element for the text you are looking for (make sure to search its children elements) and if you find it, then you can grab its parent element which will be the <em>, <strong> or <span> enclosing tags.

Edit: As for the stripping of the tags, maybe this article can help…

Adjust to the tags you want to strip of course.

Hey, this is exactly what I was looking for. Right now a little rusty with jQuery but I plan to get up to speed. Super help my friend. Thank You :smiley:

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.