Skip to content

Instantly share code, notes, and snippets.

@nocodesupplyco
Created December 19, 2022 16:39
Show Gist options
  • Save nocodesupplyco/d961af86b30f851d272805cb722625cd to your computer and use it in GitHub Desktop.
Save nocodesupplyco/d961af86b30f851d272805cb722625cd to your computer and use it in GitHub Desktop.
Set Text From URL Parameters
$(function () {
// Get URL parameters and set variables, text and CTA
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
if (urlParams.has("name") && urlParams.get("name") > "") {
//if URL has name parameter and it has a value
var firstname = urlParams.get("name");
$("#heroName").text(firstname);
} else {
$("#heroSee").hide();
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment