I have an ASP.NET MVC Page that has Left Menu navigation that is built using JQuery Treeview as in Demo #3 in ht开发者_开发技巧tp://www.dynamicdrive.com/dynamicindex1/treeview/index.htm
Here I made Childnode as href link so that rightside main partial view is loaded.
Now for the chicldnode that is clicked, I want to highlight the background-color.
Wondering how to do this?
Appreciate your time.
Thanks
jQuery
$(".treeview a").click(function(){
$(this).css("backgroundColor", "blue");
});
CSS
What would be better so that you don't have multiple 'blue' background'ed anchor tags is just extend their 'selected' class:
.treeview a.selected { background: blue; }
Try this trick also :-
$(".treeview a").click(function ()
{
$("a").css("backgroundColor", "");
$(this).css("backgroundColor", "blue");
});
Its works for me tested ... May b help full for you :::
精彩评论