Is there any way to remove a <style>
tag from the page using jquery?
and i need to remove particular style tag.
Thanks.
$(document).ready(function(){
$('style').detach();
// or
$('style').remove();
});
reference .remove() and .detach()
If you want to remove a specific style tag, you can add a class (or id) to it and then use remove() to remove that class. I have tested it and it works. I am not sure this should be allowed, but if you have no other options...
HTML
<style class="style-tag">
p {
color: #000;
}
</style>
JQuery
$('.style-tag').remove();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With