在safari 5.1.7中无法识别属性等于选择器

时间:2014-06-18 06:07:52

标签: javascript jquery css safari

我使用下面的代码来查找具有该属性的特定行。这不适用于safari 5.1.7浏览器,它会抛出错误语法错误,无法识别的表达式:#groups tr [data-group_mandatory =" true"

$('#groups tr[data-group_mandatory="true"').each(function(){        

        // Some Logic here.         
    });

2 个答案:

答案 0 :(得分:2)

你应该仔细查看你所得到的错误。您的代码中有拼写错误。你还没有为名字值选择器关闭方括号:

$('#groups tr[data-group_mandatory=true]').each(function(){        

    // Some Logic here.         
});

答案 1 :(得分:1)

您缺少关闭方括号,请按以下方式更正:

$('#groups tr[data-group_mandatory="true"]')
                                         ^-- bracket was missing
相关问题