I want to change multiple CSS styles using JavaScript. I have a button clicking which should result in changing the color
and font-size
of the <p>
.
button {color: white; background-color: black; border: none; padding: 10px 20px; transition-duration: .5s; cursor: pointer;}
button:hover {background-color: blue;}
<p id="demo">Changing multiple styles</p>
<button onclick="document.getElementById("demo").style.cssText = "fontSize: 35px; color: blue">Click Me!</button>
However, clicking the button gives me the following error:
{
"message": "Uncaught SyntaxError: Unexpected end of input",
"filename": "https://stacksnippets.net/js",
"lineno": 13,
"colno": 120
}
I did exactly what this answer suggested to a similar question. How to fix this error?