Delete a div or span with a id=“.xxx”

后端 未结 8 919
被撕碎了的回忆
被撕碎了的回忆 2021-01-19 10:45

I am unable to delete a div with an id with a period or an asterix.

相关标签:
8条回答
  • 2021-01-19 11:49

    ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods (".").

    0 讨论(0)
  • 2021-01-19 11:50

    There’s a tool for that: http://mothereffingcssescapes.com/#*xxx.

    HTML:

    <p id="*xxx.">foo bar</p>
    

    CSS:

    <style>
      #\*xxx\. {
        background: hotpink;
      }
    </style>
    

    JavaScript:

    <script>
      // document.getElementById or similar
      document.getElementById('*xxx.');
      // document.querySelector, jQuery or similar
      $('#\\*xxx\\.');
    </script>
    
    0 讨论(0)
提交回复
热议问题