Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to remove the specific inline style using jQuery [duplicate]

HTML

<div id="myDiv" style="width:100px;height:100px;transform:translate3d(0,0,0);">     //Some Content     </div> 

Using jQuery, how to remove the specific inline style i.e transform?

like image 221
Billy Avatar asked Dec 04 '13 10:12

Billy


People also ask

How to remove inline style attribute in JQuery?

Approach: The jQuery attr() and removeAttr() methods are used to remove the inline style property. The attr() method sets the attribute value to empty (”).

How do I get rid of inline style?

To remove inline Styles from an existing page, open your page with the editor, select the paragraph (or the entire content by pressing CTRL + A) and then click on Remove Formatting button. Inline styles, while they have a purpose, are not the best way to maintain your Web site.

How do you overwrite an inline style?

Using ! Adding the ! important keyword to any CSS rule lets the rule forcefully precede over all the other CSS rules for that element. It even overrides the inline styles from the markup.

How do I get rid of element style?

You can remove CSS style properties from an element by setting the property to a null value, e.g. box. style. backgroundColor = null; . When an element's CSS property is set to null , the property is removed from the element.


1 Answers

You can use css to remove the inline style:

Setting the value of a style property to an empty string removes that property from an element.

$("#myDiv").css("transform",""); 

DEMO

like image 142
Somnath Kharat Avatar answered Sep 24 '22 10:09

Somnath Kharat