Last Updated: November 19, 2020
· shekhardesigner

Remove CSS properties from Inline styles using jQuery

In some context, we have to add few inline styles with JS. Later few scenarios will need only remove selected properties from that inline styles, not the entire style attribute.

In that case you can pass null value to your CSS key:value pair and all done. Example:

$(elm).css("margin", ""); //passing value as null.

Above value will remove the margin from inline style of elm in use.

Related protips:

jQuery: When to use $(document).ready() and when $(window).load()