I have HTML string in JS where I would like to remove the span element from it.
var HTML= '<div>test</div><p>test</p><span class="removedata">X</span><span>test</span><span class="removedata">X</span>';
After removing Span, it should be look like:
HTML= '<div>test</div><p>test</p><span>test</span>';
I have tried below JavaScript operation but does not work,
HTML = HTML.replace('/<span class="removedata">X</span>/g',"");
Any inputs?