更改时我试图选择单选按钮,但出现错误
未捕获的错误:语法错误,无法识别的表达式: [name = employment [employed]]
这是我的代码示例:
$('[name=employment[employed]]').change(function(){
console.log('changed');
})
答案 0 :(得分:1)
我知道了。只需添加两个反斜杠即可。
$('[name=employment\\[employed\\]]').change(function(){
console.log('changed');
})
答案 1 :(得分:0)
下面的代码很有帮助。
$('[name=employment\\[employed\\]]').change(function(){
console.log('changed');
})