If the URL ends: ?style=product
I want to add a class of active
to the li
with the class of product
HTML:
<
use location.href to read the query parameters...
function getQuerystring(key, default_) {
if (default_==null) default_="";
key = key.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
var regex = new RegExp("[\\?&]"+key+"=([^]*)");
var qs = regex.exec(window.location.href);
if(qs == null)
return default_;
else
return qs[1];
}
var target = $("." + getQueryString("style", "default"));