Skip to content

Instantly share code, notes, and snippets.

@JenieX
Forked from pbakondy/getURLParamValue.js
Created July 31, 2025 10:20
Show Gist options
  • Save JenieX/69f17be2265969de9754c44fb757e62e to your computer and use it in GitHub Desktop.
Save JenieX/69f17be2265969de9754c44fb757e62e to your computer and use it in GitHub Desktop.
Return document URL GET parameter value by name
function getURLParamValue(name) {
var v;
document.location.search.substring(1).split('&').forEach(function(value) {
if (value.split('=')[0] === name) {
v = value.split('=')[1];
}
});
return v;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment