I want to remove the inline and external css applied to the particular div.
I don't want to use remove_all_styles() which removes all the styles of the page.
How can I achieve this?
I want to remove the inline and external css applied to the particular div.
I don't want to use remove_all_styles() which removes all the styles of the page.
How can I achieve this?
Does removing both style and class attributes do the trick?
$("#ParticularDiv").removeAttr("class").removeAttr("style");
You could try;
$("#div"){
remove_attributes()
}
Then you would have a blank slate.
Remove inline css of a particular div
$('#div_id').removeAttr('style');
Or you can do it in your css also bu using not
attribute.
In html:
<button class="nostyle">
In css:
button:not(.nostyle) {
You can do that by selecting that div
using tritium and then using the attribute(...)
function to clear out the style
attribute. Say I had the following html:
<html>
<body>
<div style="background: red">Hi</div>
</body>
</html>
I could write the following tritium to remove the inline style:
$("/html/body/div") {
attribute("style", "")
}
A shortcut to this is using the remove(...)
function in tritium. With some XPath magic, you can turn the above code into a one-liner like so:
remove("/html/body/div/@style")
And that should remove the inline styles associated with that div
.
You can remove it by $('#div') {remove_atributes()} which will remove all the attributes inside div else you can go for remove_class('ClassName') which will remove class containing style