js选择器的疑问?
phpcn_u806
phpcn_u806 2017-02-15 15:19:03
0
2
983

某个标签的id中存在#,document.getElementById可以直接选择,但是jquery就不行了,直接报错,需要怎么进行兼容性处理呢

phpcn_u806
phpcn_u806

reply all (2)
数据分析师

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.

    阿神

    试试用双反斜杠转义,即对于id="foo#bar",用$('#foo\\#bar')试试看~

      Latest Downloads
      More>
      Web Effects
      Website Source Code
      Website Materials
      Front End Template
      About us Disclaimer Sitemap
      php.cn:Public welfare online PHP training,Help PHP learners grow quickly!