Answers for "set multiple attributes javascript"

2

set multiple attributes javascript

// create a helper function
function setAttributes(el, attrs) {
  for(var key in attrs) {
    el.setAttribute(key, attrs[key]);
  }
}

// call like this
setAttributes(elem, {"src": "http://example.com/something.jpeg", "height": "100%", ...});
Posted by: Guest on January-23-2021
0

set multiple attributes css javascript

document.getElementById("myElement").style.cssText = "display: block; position: absolute";
Posted by: Guest on August-03-2020

Code answers related to "set multiple attributes javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language