If the URL ends: ?style=product
I want to add a class of active
to the li
with the class of product
HTML:
<
function getStyleValue(uri)
{
var var, hash;
var hashes = uri.slice(uri.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
if(hash[0] == 'style')
{
return hash[2];
}
}
return false;
}
then you can use like
var selected = getStyleValue('index.php?style=product2') || "product";
$('a.' + selected).addClass('selected');