Is there any way to remove a tag from the page using jquery?
and i need to remove particular style tag.
Thanks.
If you want to remove style tag from specific class or id ,then you can just mention their class or id name. Like this:
html:
<style>
.menu { display: none; }
</style>
jquery:
$('.menu style').remove();
$(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();
try remove
try this
$('style').remove();
To remove a particular style tag, you'd need to assign it an id, like this:
<style id="someid">.elem{display:none;}</style>
After that use jQuery's remove function to get rid of it, like this:
$('style#someid').remove();
I hope this helps.
$(document).ready(function(){
$('style').remove() ;
});