ITeye博客

html jquery li标签 选中

anlinko · 2021-10-31 09:36 · web前端 · Web前端 · jQuery · Markdown

[code="html"] $('.j-d-list').find($('li[data-m="2017-10"]')) var current=$("#diss").find($("dd[class='current']")); ---------------------------------------------------------------------------------------- class="current" var current=$("#workplaceSelect").find($("a[class='current']")); alert(current); alert(current.attr("districtId")); //选中一个,移除其它。始终就一个选中this.addClass('current').siblings().removeClass("current"); $('.j-d-list').find($('li[data-m="'+switchMonth+'"]')).removeClass('on').addClass('off').find('i').text(''); $("#workplaceSelect a").each(function(){$(this).attr("class","")}); --------------------------jquery-------以下调试ok代码--------------当前操作a标签加样式 选中状态 ----------------------------------------- html代码

  • 1预约
  • 2预约
  • 3预约

//获得点击选中的 属性 districtId 值 function goPage(data,type){ //alert($(data).attr("districtId")); //设置所有workplaceSelect 下的 a标签 class为"" ,不选中状态 $("#workplaceSelect a").each(function(){$(this).attr("class","")}); //当前点击a标签加class="current" $(data).addClass('current').siblings().removeClass("current"); // $(data).attr('class','current');//.siblings().removeClass("current"); //获得当前选中 workplaceSelect a标签current属性上的districtId 值 var current=$("#workplaceSelect").find($("a[class='current']")); alert(current); alert(current.attr("districtId")); var districtId =current.attr("districtId"); // alert(id); // window.location.href='http://localhost:8080/positionInfoAndCompany/list?districtId='+districtId; } [/code]

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。