If my html looked like this:
8条回答 北海茫月 (楼主) 2020-11-22 08:38 You don't need to escape anything if you use document.getElementById: $(document.getElementById('strange.id[]')) getElementById assumes the input is just an id attribute, so the dot won't be interpreted as a class selector. 0 讨论(0) 查看其它8个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
You don't need to escape anything if you use document.getElementById:
document.getElementById
$(document.getElementById('strange.id[]'))
getElementById assumes the input is just an id attribute, so the dot won't be interpreted as a class selector.
getElementById