Answers for "get query element javascript"

3

get query param javascript

const urlParams = new URLSearchParams(window.location.search);
const myParam = urlParams.get('myParam');
Posted by: Guest on November-18-2020
2

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>
Posted by: Guest on June-29-2020

Code answers related to "get query element javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language