Hi friend i wrote the code that is working in IE10..... please verify from your side and let me know if any issue....
<script type="text/javascript">
if (navigator.appName.toString() == 'Microsoft Internet Explorer') {
var arrOptGroup = $('#state_code optgroup');
var us = $(arrOptGroup[0]).detach();
var ca = $(arrOptGroup[1]).detach();
}
function validateStates(value) {
if (navigator.appName.toString() == 'Microsoft Internet Explorer') {
if (value == 'US') {
$('#state_code optgroup').remove();
$('#state_code').append(us);
}
if (value == 'CA') {
$('#state_code optgroup').remove();
$('#state_code').append(ca);
}
return;
}
var $sel = $('select[name="state_code"]');
if (value == 'US') {
$('optgroup, optgroup > option', $sel).hide();
$('optgroup[label="United States"]', $sel).children().andSelf().show();
console.log('hello there!!');
}
else if (value == 'CA') {
$('optgroup, optgroup > option', $sel).hide();
$('optgroup[label="Canada"]', $sel).children().andSelf().show();
}
else {
$('optgroup, optgroup > option', $sel).hide();
}
}
</script>