I\'m trying to replace an element\'s inline style tag value. The current element looks like this:
`
-
Use
particular_node.classList.remove("<name-of-class>")
For native javascript
讨论(0)
-
Completly removing style, not only set to NULL
document.getElementById("id").removeAttribute("style")
讨论(0)
-
In JavaScript:
document.getElementById("id").style.display = null;
In jQuery:
$("#id").css('display',null);
讨论(0)
-
Remove removeProperty
var el=document.getElementById("id");
el.style.removeProperty('display')
console.log("display removed"+el.style["display"])
console.log("color "+el.style["color"])
<div id="id" style="display:block;color:red">s</div>
讨论(0)
-
The class attribute can contain multiple styles, so you could specify it as
<tr class="row-even highlight">
and do string manipulation to remove 'highlight' from element.className
element.className=element.className.replace('hightlight','');
Using jQuery would make this simpler as you have the methods
$("#id").addClass("highlight");
$("#id").removeClass("hightlight");
that would enable you to toggle highlighting easily
讨论(0)
-
In jQuery, you can use
$(".className").attr("style","");
讨论(0)
- 热议问题