javascript - Script dosen't work in IE -
this works fine in other browsers except ie. in ie10 doesn't want cooperate. appreciated. have form drop down menu when different user makes selection brings div different form have 10 forms in can choose from. right nothing in ie, no console errors or anything.
script
var sections = { 'second': 'section2', 'third': 'section3', 'forth': 'section4', 'fifth': 'section5', 'sixth': 'section6', 'seventh': 'section7', 'eigth': 'section8', 'ninth': 'section9', 'tenth': 'section10', 'eleventh': 'section11' }; var selection = function (select) { (i in sections) document.getelementbyid(sections[i]).style.display = "none"; document.getelementbyid(sections[select.value]).style.display = "block"; } $("#target option") .removeattr('selected') .find(':first') .attr('selected', 'selected');
the html
<select id="forms" onchange="selection(this);"> <option >select option</option> <option value="tenth">general inquiry</option> <option value="second">account inquiry</option> <option value="third">arc request</option> <option value="forth">contact information update</option> <option value="fifth">contact board</option> <option value="sixth">document request</option> <option value="seventh">maintenance issue reporting</option> <option value="eigth">violations reporting</option> <option value="ninth">closing statement</option> <option value="eleventh">request proposal</option> </select>
then 11 divs
<div id="section10" style="display:none;"> <h2>general inquiry</h2> </div>
your problems turns out selection
has special meaning inside ie.
for code, ie produces following error
script5002: function expected
which tells issue.
a workaround prevent issue change function name, like
var selectionfunc = function (select){...}
and in markup,
<select id="forms" onchange="selectionfunc(this);"> .... </select>
i hope helps