[英]TypeError: jQuery(…).hexColorPicker is not a function
im trying to use color-picker jquery plugin. 即时通讯试图使用颜色选择jQuery插件。 here is the screenshot of javascript file : 这是javascript文件的屏幕截图: here is it my code to initialize it : 这是我的代码来初始化它:
<script type="text/javascript">
jQuery(function(){
jQuery("#color-picker1").hexColorPicker();
});
</script>
here is it the html element to trigger it : 这是触发它的html元素:
<input type="text" id="color-picker1" class="form-control" />
but the plugin doesnt show. 但插件不显示。 and it resulting a console log : 并生成控制台日志:
TypeError: jQuery(...).hexColorPicker is not a function TypeError:jQuery(...)。hexColorPicker不是函数
script placement : 脚本位置:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<script src="<?php echo base_url()?>assets/color_picker/src/jquery-hex-colorpicker.min.js"></script> <!-- color picker plugin-->
<link rel="stylesheet" href="<?php echo base_url()?>assets/color_picker/css/jquery-hex-colorpicker.css" /> <!-- color picker plugin-->
Make sure that the placement of your scripts as as followed, to make sure that you initialise the hex color picker after it is loaded, also missing ;
确保按如下所示放置脚本,以确保在加载十六进制颜色选择器后对其进行初始化,这也会丢失;
in <?php echo base_url();?>
在<?php echo base_url();?>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/themes/smoothness/jquery-ui.css" />
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.0/jquery-ui.min.js"></script>
<script src="<?php echo base_url();?>assets/color_picker/src/jquery-hex-colorpicker.min.js"></script> <!-- color picker plugin-->
<link rel="stylesheet" href="<?php echo base_url();?>assets/color_picker/css/jquery-hex-colorpicker.css" /> <!-- color picker plugin-->
<script type="text/javascript">
jQuery(function(){
jQuery("#color-picker1").hexColorPicker();
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.