Home > Q&A > body text
某个标签的id中存在#,document.getElementById可以直接选择,但是jquery就不行了,直接报错,需要怎么进行兼容性处理呢
数据分析师2017-10-01 00:21:20
Questions about the js selector? - PHP Chinese website Q&A - Questions about the js selector? - PHP Chinese website Q&A
Take a look around and learn.
阿神2017-02-15 15:20:03
试试用双反斜杠转义,即对于id="foo#bar",用$('#foo\\#bar')试试看~