看起来 IE8 不支持 Jquery.filter()
方法 -为什么 .filter() 在 Internet Explorer 8 中不起作用?
我有以下代码过滤下拉列表
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();
});
}
问题线是
return ($(this).text() == $('#deliveryPostcodeEstimator').val().toUpperCase().substring(0,4).trim())
这给出了以下错误
Object doesn't support this property or method
如何按照上一篇文章中的建议“将其包装在一个对象中”?
谢谢