Trying to remove all block elements from a string containing HTML. Below doesn't work properly though.
Anyone see anything wrong with my RegEx pattern or something?Code:for(var i = 0; i < blockElems.length; i++){ var pattern = '(<' + blockElems[i] + '[^>]*>|<\/' + blockElems[i] + '>)'; var re = new RegExp(pattern, 'gi'); selectedElem.replace(re, ''); }