I wrote this code in order to set the text color of an active menu item:
$(document).ready(function () {
var url = window.location.href;
var pieces = url.split("?whatPage=");
$('#pieces[1]').css('color', 'red');
});
If I alert pieces[1] I get the value of the ID of the relevant menu item, but the menu item's color is unaffected. What is most likely to be going wrong?
$('#' + pieces[1])