<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
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。