javascript - How to always remove inline style for specific element? -


how remove inline style specific element?

i use code remove style :

jquery('.myelement').removeattr('style'); 

but it's not work because js code adding inline style after me code remove it. there no .js file after file called.

i know can edit .js file photo plugin if update plugin, loose changes.

how can write in jquery tell element never have inline style?

to ensure items style empty, if other code runs after yours can use mutation observer reset style whenever style attribute of node changes, this

let element = document.queryselector(".myelement");    let observer = new mutationobserver((m) => {    if (element.style.length > 0) {      element.style = {};    }  });    observer.observe(element, {    attributes: true,    attributefilter: ["style"]  });      // wont  element.style.backgroundcolor = "red";
<div class="myelement">    unicorn  </div>


Comments

Popular posts from this blog

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -