On login page when a customer wants to purchase wifi service they click on a link http://siteurl/terms.html?premium=show. I need to have the terms page display a hidden division if premium exist and is equal to show without using php.
Asked
Active
Viewed 111 times
1 Answers
1
You can use .toggle(flag)
with true/false for show/hide of the selected element:
function getParameterByName(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}
$('hiddendivselector').toggle(getParameterByName('premium')=="show")

Community
- 1
- 1

Milind Anantwar
- 81,290
- 25
- 94
- 125