我很困惑,我似乎无法让onchange事件在bootstrap 3站点中为选择控件事件工作,这是我在文档的页脚,所有脚本加载& datepicker工具有效:
<script type="text/javascript" src="assets/jquery/1.11.0/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap.min.js"></script>
<script type="text/javascript" src="assets/js/moment.js"></script>
<script type="text/javascript" src="assets/js/docs.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap-datepicker.js"></script>
<script>
$(window).load(function(){
$('#urlfilter').change(function(){
alert("The select has been changed.");
});
$('#urlfilter').on('change', function(){
alert("The select has been changed.");
});
$(function () {
$('#datepicker').datetimepicker({pickTime: false });
$('#start_date').datetimepicker({pickTime: false });
$('#end_date').datetimepicker({pickTime: false });
$('#paid_date').datetimepicker({pickTime: false });
$('#date').datetimepicker({pickTime: false });
});
});
然后在页面中:
<form>
<select id="urlfilter" name="status_id" >
<option ></option>
<option value="http://www.xxx.ca">option</option>
<option value="http://www.yyy.ca">option</option>
</select>
</form>
改变功能根本不起作用,没有警报,控制台中没有脚本错误,没有。
使这项工作的正确方法是什么?