jQuery 重新绑定还是新元素上的实时事件?
我正在使用这个 timepicker ,它效果很好,但问题是我正在动态添加输入字段,并且时间选择器不适用于新创建的输入标签
我正在使用这个 jQuery
$('.timepicker').timePicker({
startTime: "02.00", // Using string. Can take string or Date object.
endTime: new Date(0, 0, 0, 15, 30, 0), // Using Date object.
show24Hours: false,
separator:'.',
step: 15
});
我让某人单击一个按钮,并且带有类时间选择器的新输入字段被附加到页面,但 jQuery 时间选择器不起作用。 .任何想法如何绑定...
我试过这个
$('.timepicker').bind('click', function(){
$('.timepicker').timePicker({
startTime: "02.00", // Using string. Can take string or Date object.
endTime: new Date(0, 0, 0, 15, 30, 0), // Using Date object.
show24Hours: false,
separator:'.',
step: 15
});
});
但没用
I am using this timepicker which works great but the problem is I am adding the input fields on the fly and the time picker is not working on newly created input tags
I am using this jQuery
$('.timepicker').timePicker({
startTime: "02.00", // Using string. Can take string or Date object.
endTime: new Date(0, 0, 0, 15, 30, 0), // Using Date object.
show24Hours: false,
separator:'.',
step: 15
});
I am having someone click a button and a new input field with the class time picker is getting appended to the page but the the jQuery time picker is not working...any ideas how to bind...
I tried this
$('.timepicker').bind('click', function(){
$('.timepicker').timePicker({
startTime: "02.00", // Using string. Can take string or Date object.
endTime: new Date(0, 0, 0, 15, 30, 0), // Using Date object.
show24Hours: false,
separator:'.',
step: 15
});
});
But didn't work
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用实时 -
演示 - http://jsfiddle.net/Spfpj/4/
Use live -
Demo - http://jsfiddle.net/Spfpj/4/