“JS QuerySelector -Namen” Code-Antworten

JS QuerySelector -Namen

// This selects the first element with that name
document.querySelector('[name="your-selector-name-here"]');
Uber-Dan

document.querySelector

<div id="foo\bar"></div>
<div id="foo:bar"></div>

<script>
  console.log('#foo\bar');               // "#fooar" (\b is the backspace control character)
  document.querySelector('#foo\bar');    // Does not match anything

  console.log('#foo\\bar');              // "#foo\bar"
  console.log('#foo\\\\bar');            // "#foo\\bar"
  document.querySelector('#foo\\\\bar'); // Match the first div

  document.querySelector('#foo:bar');    // Does not match anything
  document.querySelector('#foo\\:bar');  // Match the second div
</script>
Ugliest Unicorn

Ähnliche Antworten wie “JS QuerySelector -Namen”

Fragen ähnlich wie “JS QuerySelector -Namen”

Weitere verwandte Antworten zu “JS QuerySelector -Namen” auf JavaScript

Durchsuchen Sie beliebte Code-Antworten nach Sprache

Durchsuchen Sie andere Codesprachen