Inside this div, there is a paragraph:
This is the HTML code:
<div id="header"><p>Header</p></div>
This is the CSS code:
#header p {
color: darkgray;
font-size: 15px;
Whenever a button is clicked, the innerHTML gets updated:
Here is the Javascript code:
var header = document.getElementById('header')
header.innerHTML = "Changed"
But once the innerHTML is changed, the text goes back to its original style. My goal is for the text to maintain its color (darkgray) and font size (15px).
You can check out the JS Fiddle here.