0

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.

1 Answers1

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")

Function getparameter refered from

Community
  • 1
  • 1
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125