Last Updated: September 29, 2021
·
55.18K
· 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:

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

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()