IE7/IE8 javascript drop down menu used to redirect not working
Posted
by
Robbiegod
on Stack Overflow
See other posts from Stack Overflow
or by Robbiegod
Published on 2012-03-30T23:27:32Z
Indexed on
2012/03/30
23:29 UTC
Read the original article
Hit count: 223
JavaScript
|jQuery
The error I see from IE7/IE8 in Jquery v1.7.2 and v.1.7.1 - i tried both:
SCRIPT438: Object doesn't support property or method 'apply'
My Code:
<form>
<select id="stateD" OnChange="showState()">
<option value="none" selected="selected">==========</option>
<option value="http://www.google.com">google</option>
<option value="http://www.yahoo.com">Yahoo</option>
</select>
</form>
My Javascript - I have this pasted just below the webform:
<script type="text/javascript">
function showState(){
oStates = document.getElementById("stateD");
var jLink = $("#stateD :selected").val();
if (jLink == undefined || jLink == "none" ){ alert("Please Select a State"); }
else{ document.location.href=jLink};
}
</script>
I'm not using 2 libraries so i don't get why its having a problem. All that is supposed to happen is you select a url from the drop down menu and it auto sends you to that url that is in the value of the option tag. Works everywhere else, not sure why IE has to be such a jerk today.
I'd post a url but i can't at the moment. its private. has anyone encountered this issue before?
© Stack Overflow or respective owner