Wordpress 3.9和jQuery通配符选择器问题
我正在尝试使用以下代码实现“checkall”:Wordpress 3.9和jQuery通配符选择器问题,jquery,wordpress,Jquery,Wordpress,我正在尝试使用以下代码实现“checkall”: <script> jQuery('.grpInclude').on('click', function(e){ e.preventDefault(); var checkBoxes = jQuery('input[id=*"grpInc"]'); checkBoxes.prop("checked", !checkBoxes.prop("checked")); }); &l
<script>
jQuery('.grpInclude').on('click', function(e){
e.preventDefault();
var checkBoxes = jQuery('input[id=*"grpInc"]');
checkBoxes.prop("checked", !checkBoxes.prop("checked"));
});
</script>
jQuery('.grpInclude')。在('click',函数(e)上{
e、 预防默认值();
var复选框=jQuery('input[id=*“grpInc”]');
复选框.prop(“选中”),!复选框.prop(“选中”);
});
但是,它总是失败:错误:语法错误,无法识别的表达式:input[id=*“grpInc”]
我也尝试过将其作为input[id=^“grpInc”]
使用,但失败的原因是同样的问题
如何修复以下是通配符和属性选择器的正确语法:
jQuery("input[id^=grpInc]")