我有一个 jquery 选择器,如下所示:
var val = "John's cars";
$('#subject input[value="'+val+'"]')
这在 Firefox、Chrome、Internet Explorer 8 中运行良好,但在 IE 6 或 IE7 中不起作用。 问题出在文本搜索中的 ' 。 除了循环遍历所有有问题的输入并进行字符串比较之外,有人知道如何解决这个问题吗?
最佳答案
试试这个:
var val = "John's cars";
$('#subject input').filter(function() {
return this.value == val;
});
关于Internet Explorer 中的 JQuery 选择器问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1533618/