Bootstrap colorpicker不起作用。这是我的代码
<div class="form-group"style="margin-top:-10px">
<label style=" height:20px !important ;font-size: 12px;" class="col-sm-4
control-label">Kurye Durum Renk</label>
<div class="col-sm-7">
<input id="ColorPickerKuryeDurumRenk" type="text" class="form-control">
</div>
</div>
<link rel="stylesheet" src="plugins/colorpicker/bootstrap-colorpicker.min.css">
<script src="plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script>
$(document).ready(function(){
$("#ColorPickerKuryeDurumRenk").colorpicker();
});
</script>
当我运行这样的代码时,我没有得到任何错误,但颜色选择器不起作用。我的失败在哪里?
答案 0 :(得分:2)
<link rel="stylesheet" src="plugins/colorpicker/bootstrap-colorpicker.min.css">
要导入样式表,您需要使用href =&#34; PATH_OF_FILE&#34;
答案 1 :(得分:1)
很确定你的lib路径错误或引用不正确。
尝试使用以下内容,如果它正常工作,那么您可以逐个删除调试(并改为使用本地参考)
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-colorpicker/2.5.1/css/bootstrap-colorpicker.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-colorpicker/2.5.1/js/bootstrap-colorpicker.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-colorpicker/2.5.1/css/bootstrap-colorpicker.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-colorpicker/2.5.1/js/bootstrap-colorpicker.min.js"></script>
<div class="form-group"style="margin-top:-10px">
<label style=" height:20px !important ;font-size: 12px;" class="col-sm-4
control-label">Kurye Durum Renk</label>
<div class="col-sm-7">
<input id="ColorPickerKuryeDurumRenk" type="text" class="form-control">
</div>
</div>
<link rel="stylesheet" src="plugins/colorpicker/bootstrap-colorpicker.min.css">
<script src="plugins/colorpicker/bootstrap-colorpicker.min.js"></script>
<script>
$(document).ready(function(){
$("#ColorPickerKuryeDurumRenk").colorpicker();
});
</script>
&#13;