开发者

HTML Menu : Set Selected item Icon Highlited

I have a list of images. When one is clicked, I want it to highlight that image and set the others normal. Could th开发者_JAVA技巧is be done with jQuery toggle ?


Try something like this:

$('img').click(function() {
  $(".highlight").removeClass("highlight");  //remove the highlight css class from anything that has it
  $(this).addClass("highlight"); //add the highlight css class to the image that was clicked.
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜