javascript - 通过jquery循环Ul和Li

标签 javascript jquery html

我需要在jquery中循环遍历ul和li,并需要在jquery中获取标签值。我正在做一个asp.net c#

我的Html如下

<ul id="ctl00_DashboardContent_cblUsers" class="reprp checkWrp scroll" style="width: 100%;">
  <li>
    <span title="Thomas"><input name="ctl00$DashboardContent$cblUsers$1" />
	<label for="ctl00_DashboardContent_cblUsers_0">Thomas</label>
  </span>
  </li>
  <li>
    <span title="Abraham"><input name="ctl00$DashboardContent$cblUsers$1" />
        <label for="ctl00_DashboardContent_cblUsers_1">Abraham</label>
    </span>
  </li>
</ul>

我需要通过jquery获取标签值

我尝试了以下代码,但它没有循环

$('<%=cblUsers.ClientID %>').find('li').each(function (index, element) {
});

最佳答案

$('<%=cblUsers.ClientID %>'

似乎是未在服务器端处理的。您想要使用 CSS 选择器,例如:

$('#ctl00_DashboardContent_cblUsers')

关于javascript - 通过jquery循环Ul和Li,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41690320/

相关文章:

javascript - 使用查询检查 iframe 中的 css

html - 如何在 iframe 中使用图片

javascript - 从 json 加载唯一数据

javascript - 使最后一行不可排序

javascript - Angularjs 和 jquery html5Loader

javascript - 右对齐 HTML 标签

javascript - html canvas 检查对象是否处于 Angular

javascript - OpenLayers 不显示 kml 图层

javascript - 如何使用 "q"模块重构 mongoose 代码?

javascript - 如何在 MVC 4 中包含基于 JavaScript 的插件?