getAttribute and setAttribute() in Javscript
getAttribute and setAttribute() in Javascript
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Document</title>
</head>
<body>
<div class="hero" style="color: rgb(9, 248, 168);">
<h2 id="first">CLASS 1</h2>
<p>Lorem ipsum dolor sit amet.</p>
<p>Lorem, ipsum dolor sit amet consectetur adipisicing elit. Quam, distinctio.</p>
</div>
<div class="hero">
<h2 id="second">CLASS 2</h2>
<p>Lorem ipsum dolor sit amet consectetur.</p>
<p>Lorem ipsum dolor sit amet consectetur, adipisicing elit.</p>
</div>
<div class="hero2">
<h2 id= "third">CLASS 3</h2>
<p>Lorem ipsum dolor sit amet consectetur.</p>
<p>Lorem ipsum dolor sit amet consectetur adipisicing elit.a omnis tempora?</p>
</div>
<button id="ty" style="color: rgb(204, 255, 20); background-color: rgb(50, 146, 224);" width="600px" height ="100px">HELLO THERE</button>
<script>
document.querySelector("#ty").setAttribute("height","250px");
var a = document.querySelector("#ty").getAttribute("height");
console.log(a);
</script>
</body>
</html>
Comments
Post a Comment
I WOULD APPRECIATE IF YOU LEAVE A COMMENT OR YOUR FEEDBACK HERE !!!