标签: javascript jquery html bootstrap-select
答案 0 :(得分:4)
这是因为你有两个类colorpicker的元素。您要将其附加到select.colorpicker和div.colorpicker
colorpicker
select.colorpicker
div.colorpicker
即$('.colorpicker').length == 2
$('.colorpicker').length == 2
您可以使用$('select.colorpicker').each
$('select.colorpicker').each