Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE html>
<html>
<head>
</head>
<body>
<h1>Hello Javascript!</h1>
<button onclick="Func()">Click</button>
<script>
function Func() {
var h1 = document.getElementsByTagName("H1")[0];
var attr = document.createAttribute("id");
attr.value = "h1tag";
h1.setAttributeNode(attr);
document.getElementById(attr.value).style.color = "blue";
}
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507