/text-from-url-parameters.js Secret
Created
December 19, 2022 16:39
Set Text From URL Parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(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