Answer the question
In order to leave comments, you need to log in
How to add an attribute to a tag using JS?
There is a yukoz system file that is loaded automatically with the page:
<link href="/.s/src/uAdmDesktop/css/uadm.css" rel="stylesheet" type="text/css" />
Answer the question
In order to leave comments, you need to log in
Something like this can be added.
You need to select or lookup an element by its id let liElem = document.getElementById("id");
Or by tag name let liElem = document.getElementsByTagName('link');
Depending on this, delete unnecessary.
You can add an id to the desired element and call a function on it after the page is loaded.
function addAtrib() {
let yourElem = document.getElementById("id");
let yourElem = document.getElementsByTagName('link');
yourElem.setAttribute('rel', 'preload');
};
window.addEventListener("load", addAtrib);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question