Skip to content

Instantly share code, notes, and snippets.

@moloy666
Created April 22, 2024 10:26
Show Gist options
  • Save moloy666/d2724ad08ca5e4d97c87c4fc32c4fa8e to your computer and use it in GitHub Desktop.
Save moloy666/d2724ad08ca5e4d97c87c4fc32c4fa8e to your computer and use it in GitHub Desktop.
get query parameter value from url in javascript
var urlString = "https://example.com/page?param1=value1&param2=value2";
var urlParams = new URLSearchParams(urlString);
var paramValue = urlParams.get('param1');
console.log(paramValue);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment