多选标签

 <div class="v29">
<div class="v32">标准 :</div>
<div class="v33 " id="main">
<volist name="standard" id='vv'>
<a href="#" class="test3" >
<div class="zhun pt" bid="{$vv.id}" style="margin-left: 3rem;">
{$vv.standard}
</div>
</a>
</volist>

</div>
</div>
</div>
script:
$(document).on('click', '.zhun', function () {
bid = $(this).attr("bid");

if ($(this).is('.pt')) {
$(this).removeClass('pt')
$(this).addClass('green')
inputbiao = $("#biao").val();
bbid = bid +',' +inputbiao
biao = $('.biao').val(bbid);

} else {

var biao=$("#biao").val();
biao = biao.split(',')
for ( var i = 0 ; i < biao.length; i ++){
if (biao[i] == bid) {
delete biao[i]
}
}
// arr=biao.join(",");
$(this).removeClass('green')
$(this).addClass('pt')
biao = $('.biao').val(biao);

}
})
原文地址:https://www.cnblogs.com/maohongli/p/12841416.html