I'm trying to change the font of a div with an option selector.
so i have the div with the text "hello folks" and i want to change the font-family either font1 or font2 (or font3)
But i can't imagine a right way and i'm getting really confused whether to define styles by css classes or by javascript referenc. could anybody help me??
<div id="output-text">
hello folks
</div
<label for="input-font">
Font
</label>
<br>
<select id="input-font" class="input" onchange="changeFont (this);" size="2">
<option selected ="selected"/>
Helvetica
<option />
Arial
</select>
<br>
a simple change font script would be this, but i cant bring them together with that options dropdown
function changeFont(){
var userInput = document.getElementById('input-font').value;
document.getElementById('output_font').innerHTML = userInput;
}
but i guess i'm totally wrong here