Can someone think of a reason that this wouldn't work in any version of IE? I have a drop down select menu for choosing the font family of an element, which calls a javascript function to change the font-family. Here is the html...
<select id="selecth1FontFamily" name="selectFontFamily" onchange="updateh1family();">
<option> Serif </option>
<option> Arial </option>
<option> Sans-Serif </option>
<option> Tahoma </option>
<option> Verdana </option>
<option> Lucida Sans Unicode </option>
</select>
And here is the JavaScript...
function updateh1family() {
var selector = document.getElementById('selecth1FontFamily');
var cssPreviewSpan = document.getElementById('h1FontFamily');
cssPreviewSpan.innerHTML = selector.value;
// also update the CSS preview
var h1 = document.getElementById('liveh1')
h1.style.fontFamily = selector.value;
}
This works to change the font family of the element in EVERY browser, minus the dreaded internet explorer. Any thoughts? I mean, it is a fairly straightforward function, I tried to think of other ways to go about it but I'm pretty much stuck. Thank you to all who read this!
If you debugged the code you would see that selector.value returns nothing.
JSBin