Reputation: 1
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.
Upvotes: 0
Views: 113
Reputation: 82241
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")
Function getparameter refered from
Upvotes: 1