且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在点击链接时显示一个div并隐藏其他人

更新时间:2023-12-01 10:27:22



Something along the line of :

$('a').on('click', function(){
   var target = $(this).attr('rel');
   $("#"+target).show().siblings("div").hide();
});

应该这样做。

PS :你的div必须放在容器中才能工作。
小提琴

P.S: your divs have to be in a container for this to work. Fiddle.