I have a Javascript array which contains items of string values. However, some of these items contain text in between HTML tags. Below is an example of my array.
var myArr = ["Weather", "very", "<span style="font-weight:bold;">nice</span>"]
How could I strip the <span></span> tags from the array leaving just the word nice?
I have looked into using jquery’s .match() to detect if the array contains HTML, but I’ve no success when testing it in JSFiddle.
Thankyou in advance.
UPDATED
An updated version that prevents against XSS attacks making use of
$.parseHTML.PREVIOUS UPDATE
Probably you can try something along these lines:
See it here.