[JQuery] tab
jQuery(function(){ var btn = $(".tabList li"); var list = $(".tabBox"); list,btn.each(function(i){ var idx = i-1; $(this).click(function(){ list.css("display","none").eq(idx).css("display","block"); if(btn.hasClass("on")){ btn.removeClass("on") } btn.eq(idx).addClass("on"); }); idx++; }); }); <ul class="tabList" id="tab"> <li class="">menu01</li> <li class="">menu02</li> <li class="">menu03</li> <li class="">menu04</li> </ul> <div class="subCont"> <div class="tabBox" style="display:block">텝1</div> <div class="tabBox">텝2</div> <div class="tabBox">텝3</div> <div class="tabBox">텝4</div> <