开发者社区> 问答> 正文

jquery收集选择数据的问题

<div id="nationality">
<span id="nationality_1" class="label label-success">上海</span>
<span id="nationality_2" class="label label-success">北京</span>
<span id="nationality_3" class="label label-success">天津</span>
<span id="nationality_4" class="label">重庆</span>
<span id="nationality_5" class="label">河北</span>
<span id="nationality_6" class="label">山西</span>
<span id="nationality_7" class="label">内蒙古</span>
<span id="nationality_8" class="label">福建</span>
<span id="nationality_9" class="label">吉林</span>
<span id="nationality_10" class="label">黑龙江</span>
<span id="nationality_11" class="label">江苏</span>
<span id="nationality_12" class="label">浙江</span>
<span id="nationality_13" class="label">安徽</span>
<span id="nationality_14" class="label">辽宁</span>
<span id="nationality_15" class="label">江西</span>
<span id="nationality_16" class="label">山东</span>
<span id="nationality_17" class="label">河南</span>
<span id="nationality_18" class="label">湖北</span>
<span id="nationality_19" class="label">湖南</span>
<span id="nationality_20" class="label">广东</span>
<span id="nationality_21" class="label">广西</span>
<span id="nationality_22" class="label">海南</span>
<span id="nationality_23" class="label">四川</span>
<span id="nationality_24" class="label">贵州</span>
<span id="nationality_25" class="label">云南</span>
<span id="nationality_26" class="label">西藏</span>
<span id="nationality_27" class="label">陕西</span>
<span id="nationality_28" class="label">甘肃</span>
<span id="nationality_29" class="label">宁夏</span>
<span id="nationality_30" class="label">青海</span>
<span id="nationality_31" class="label">新疆</span>
<span id="nationality_32" class="label">香港</span>
<span id="nationality_33" class="label">澳门</span>
<span id="nationality_34" class="label">台湾</span>
<span id="nationality_35" class="label">国外</span>
</div>

如何用jQuery收集出所有包含有label-success这个class的nationality编号即,var code = '1,2,3' 因为1,2,3 具有这个class

展开
收起
a123456678 2016-07-07 14:42:38 1757 0
1 条回答
写回答
取消 提交回答
  • screenshot

    2019-07-17 19:52:49
    赞同 展开评论 打赏
问答分类:
问答标签:
问答地址:
问答排行榜
最热
最新

相关课程

更多

相关电子书

更多
23-Vue.js在前端...1506518547.pdf 立即下载
基于VUE的单页面性能优化实践 立即下载
现代Javascript高级教程 立即下载