Home > Software engineering >  Remove or modify inline css
Remove or modify inline css

Time:11-17

I have the following html from my page builder. I want to remove z-index.

<div  data-css="tve-u-17f1c45d6a7" id="mcards" style="z-index: 14 !important;">

Tried following 3 options but not working :

document.getElementById("mcards").removeAttribute("style");
$("#mcards").css({"z-index": "1!important"});
$('#mcards').removeAttr('style');

CodePudding user response:

your code should like this,

 $(document).ready(function(){
    //$("#mcards").css({"z-index": "unset"});
    $('#mcards').removeAttr("style");
 
 });    
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<div  data-css="tve-u-17f1c45d6a7" id="mcards" style="z-index: 14 !important;">test</div>

  • Related