开发者

JQuery Treeview Highlight the Background color for the Child Node that is clicked on ASP.NET MVC Page

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 :::

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜