This code is not working
var span = document.getElementById("span"); span.style.fontsize = "25px"; span.innerHTML = "String";
In the javascript function, here changeFontStyle(), the fontFamily property value is set to the font value of the option selected. By default, it is set to Times New Roman. Output: Before selecting any option (Initial value – Times New Roman):
To change the font size of a div using JavaScript, get reference to the div element, and assign required font size value to the element. style. fontSize property.
JavaScript is case sensitive.
So, if you want to change the font size, you have to go:
span.style.fontSize = "25px";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With