Internet Explorer中的jQuery选择器问题 [英] JQuery selector problem in Internet Explorer

查看:88
本文介绍了Internet Explorer中的jQuery选择器问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个jquery选择器,看起来像:

I have a jquery selector that looks like:

var val = "John's cars";
$('#subject input[value="'+val+'"]')

这在Firefox,Chrome,Internet Explorer 8中很好用,但在IE 6或IE7中却不能. 问题是文本搜索中的. 除了遍历所有有问题的输入并进行字符串比较之外,有人知道如何解决此问题吗?

This works just fine in Firefox, Chrome, Internet Explorer 8, but not in IE 6 or IE7. The problem is the ' in the text search for. Someone has any idea how to work around this problem except to loop through all inputs in question and do a string compare?

推荐答案

尝试一下:

var val = "John's cars";
$('#subject input').filter(function() {
    return this.value == val;
});

这篇关于Internet Explorer中的jQuery选择器问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆