Just check the following code.
<script type="text/javascript"src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
function s() {
supplier = jQuery('#sup').val();
status = jQuery('#sta').val();
alert('Supplier:'+supplier+'#Status:'+status);
}
</script>
<select id="sup">
<option value="empty">Supplier</option>
<option value="1">supplier1</option>
<option value="2">supplier2</option>
</select>
<select id="sta">
<option value="empty">Status</option>
<option value="1">status1</option>
<option value="2">status2</option>
</select>
<button type="button" onclick='s()'>Show</button>
When I click the show-button, I am getting the value of status in FF .
But in ie, alert shows that the status contain empty-string.
Note that the supplier and status has the same structure.
The value of supplier is getting correctly in both browser.
It’s broken because you are using the global
statusvariable – which should be used for setting status bar messages. You need to put:var statusin your function
s, notstatusor just use a different variable name.See this fiddle: http://jsfiddle.net/HPR3w/2/ with the change made. I’ve tested it in IE9 and it works now.