how can i remove style tag inside html
i want remove complete style tag and css inside it i try this:
html = html.replace(/<br>/g, ' ');
console.log('0='+html);
html2 = html.replace(/<div>/g, ' ');
console.log('1='+html2);
html2 = html2.replace(/ /g, ' ');
html2 = html2.replace(/(<([^>]+)>)/ig,"");
but this just remove style tag and don't remove css
You can use the jQuery .remove()
method to remove any style tags from your page :
$('html').find('style').remove();
If the HTML is in a variable ( html ), use:
$('style', html).remove();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.