Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Change Attribute

make

select color = onchange = changeBG(this)
div content chat id = bodyQ
select = onchange = select_q
button id = insertQ


var element = document.getElementById("elemId");
element.setAttribute("attributeName", "value");
----------
element.setAttribute(<name>, <value>);
// ex
var aElement = document.querySelector("a"); 
aElement.setAttribute("href", "https://isitchristmas.com/"); 
-----
  var a = document.getElementById("id");

xx.className = "MyClass"

//variable.setAttribute("Attributes","Properties:Values")
a.setAttribute("style", "visibility:hidden;");
-----------
  element.setAttribute(name, value);
element.setAttribute("style", "background-color: red;");
----
Element.setAttribute(name, value);
----------
document.getElementsByTagName("H1")[0].setAttribute("class", "democlass");
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #Change #Attribute
ADD COMMENT
Topic
Name
6+4 =