jquery - jquery按名称选择带有数组名称的单选按钮
问题描述
我在更改时尝试选择单选按钮,但出现错误
未捕获的错误:语法错误,无法识别的表达式:[name=employment[employment]]
这是我的代码示例:
$('[name=employment[employed]]').change(function(){
console.log('changed');
})
解决方案
我想到了。只需添加两个反斜杠。
$('[name=employment\\[employed\\]]').change(function(){
console.log('changed');
})
推荐阅读
- python - 我正在尝试使用 python 3.8 获取日语句子。但我只是得到难以理解的字符,有人可以帮助我吗?
- vue.js - Vuetify Datepicker-启用多个属性但显示错误的选定日期计数
- windows - 从托盘图标最大化表单后出现错误
- node.js - 如何使用 Puppeteer 编辑 PDF?
- cypress - 赛普拉斯没有加载更新的文件
- sql-server - 识别 SSIS SQL 服务器中 SCD 类型 2 中更改的列
- python - 使用python对数字范围进行排序以找到一个覆盖其他值的范围
- go - How to draw polygons in golang without anti-aliasing?
- reactjs - 反应点击元素的切换可见性
- javascript - javascript regex tags with full webaddress (text mining, inverse match)