[英]Javascript alert more than one
for some reason I'm getting alert more than once. 由于某种原因,我不止一次收到警报。 Here is my code:
这是我的代码:
$('.input-append.date').datepicker({
format: "MM yyyy",
startView: 1,
minViewMode: 1,
autoclose: true
});
$('.input-append.date').on('change', function() {
var one = $("#month").val();
alert(one);
return false;
});
<div class="input-append date">
<input id="month" type="text" placeholder="Select Month" class="span8"><span class="add-on"><i class="icon-th"></i></span>
</div>
Why is that? 这是为什么? Here is a demo : http://jsfiddle.net/HFuDg/168/
这是一个演示: http : //jsfiddle.net/HFuDg/168/
Please help and thanks in advance. 请帮助并提前致谢。
Not sure why change
fires multiple times but if you bind to hide
, that fires once. 不知道为什么
change
会多次触发,但是如果您绑定到hide
,则会触发一次。
$('.input-append.date').on('hide', function() {
var one = $("#month").val();
alert(one);
return false;
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.