Issue with DOM manuplation in service portal

Phanindra N
Tera Guru

I tried the following code for DOM manipulation from script tag in html

 

window.onload= function () {
      removeStyleTag();
}
function removeStyleTag(){
var styleArr = [];
styleArr = document.getElementsByClassName("ka_style");
var j;
for(j = 0 ; j < styleArr.length; j++){
styleArr[j].setAttribute("media", "max-width:1px");
}

}

It is not running for the first time page loads, if I reload it is working correctly. It should after the complete page loads, which is not happening.

I tried writing it in client script and trigger by using ng-init, still same.

 

How can I achieve it, any other way. 

Appreciate your help.

0 REPLIES 0