Answers for "function to change paragraph style on button click"

0

function to change paragraph style on button click

<!DOCTYPE html>
<html><head>
<meta charset=utf-8 />
<title>JS DOM paragraph style</title>
</head> 
<body>
<p id ='text'>JavaScript Exercises - w3resource</p> 
<div>
<button id="jsstyle"
onclick="js_style()">Style</button>
</div>
<script>
function js_style(){
let p = document.getElementById("text");
p.style.color = "red";
}
</script>
</body>
</html>
Posted by: Guest on October-10-2021

Code answers related to "function to change paragraph style on button click"

Browse Popular Code Answers by Language