It looks like IE8 doesn't support the Jquery .filter()
method - Why won't .filter() work in Internet Explorer 8?
I have the following code which filters a dropdown list
if($('#deliveryPostcodeEstimator').length > 0) {
$('.shippingregionselector').hide();
$('#deliveryPostcodeEstimator')
.blur(function() {
//Set to default
$('select[name=country] option:last').prop('selected', true);
//var defaultPostcode = 'GL50';
//$("select[name=country] option").filter(function() {
// return $(this).text() == defaultPostcode;
//}).prop('selected', true);
//Set to matching postcode value if set
$('select[name=country] option').filter(function(index) {
return ($(this).text() == $('#deliveryPostcodeEstimator').val().toUpperCase().substring(0,4).trim())
}).prop('selected', true);
//Submit
var thisForm = $(this).closest("form");
thisForm.submit();
})
.keyup(function() {
$(this).val($(this).val().toUpperCase());
});
$('button.pcodechange').click(function() {
var thisForm = $(this).closest("form");
thisForm.submit();
});
}
The problem line is
return ($(this).text() == $('#deliveryPostcodeEstimator').val().toUpperCase().substring(0,4).trim())
Which gives the following error
Object doesn't support this property or method
How do I 'wrap this in an object' as suggested in the previous post?
Thanks