代码改变世界

jq选中问题

2016-06-13 10:47  sihao560  阅读(162)  评论(0编辑  收藏  举报

var objs = $("div[id^='offer_details_']");

//遍历点击事件监听问题

onclick="details("+offer.id+")“

function details(offerId){

}

 

//tabs页签切换事件
$(document).ready(function () {
  $("#tabs li").bind("click", function () {
    var index = $(this).index();//输出选中的下标
    alert(index);
    //var divs = $("#tabs-body > div");//选中下一级div
    //divs.hide();//隐藏所有选中项内容
    //divs.eq(index).show(); //显示选中项对应内容
    $(this).parent().children("li").attr("class", "");//将所有选项置为未选中
    $(this).attr("class", "am-active"); //设置当前选中项为选中样式

  });

});