I would like to remove all instances of a .class in an html.
remove class “s”
remove <span class="s">some text</span> in html
Output
remove some text in html
What’s the easiest way to do this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Here’s a plain JavaScript solution. It might look a bit long at first sight, but it simply does what you want:
removeClassrecursively scans elements looking for the specified class, and if found, callsmoveElements, which moves the children outside and removes the original element. To run it through the entire document, removing the classs(from your example), call it like this:Here’s a working example on JSBin.