---
title: "html jquery  li标签 选中"
author: "anlinko"
date: "2021-10-31T09:36:16Z"
tags: ["jQuery"]
categories: ["Web前端"]
slug: "html-jquery-li"
draft: false
lastmod: "2021-10-31T09:36:16Z"
id: 2521332
url: "https://anlinko.iteye.com/blog/2521332"
---

\[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]