Skip to content

Instantly share code, notes, and snippets.

@gilchris
Last active November 30, 2017 07:42
Show Gist options
  • Save gilchris/c17e8a0a2ecb7a09b2edf977c5c3ad57 to your computer and use it in GitHub Desktop.
Save gilchris/c17e8a0a2ecb7a09b2edf977c5c3ad57 to your computer and use it in GitHub Desktop.
get parameter value from url
// https://stackoverflow.com/a/35430091/1615988
function getQuery(q) {
return (window.location.href.match(new RegExp('[?&]' + q + '=([^&]+)')) || [, null])[1];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment