jQuery live span 在第二次单击之前不会更新
要查看此信息,请访问
预订右侧的 http://offline.raileisure.com/路段,选择站长之家,然后选择入住日期8月15日。然后选择 4 天...
好的
现在返回并选择另一个日期 8 月 29 日。
4 天应该取消选择,但直到您在其他任何地方进一步单击后才会出现...
我想我需要更新实时属性。但不确定。
取消勾选我正在使用的#spanduration
:
$('input[name="duration"]').removeAttr('checked');
$("#spanduration").attr("style", "background-position: 0px 0px;");
但只有在您在任意位置进行第二次单击之前它才起作用。
To check this out please go to http://offline.raileisure.com/
on the right hand side the booking section, choose station masters house, then choose a check in date of 15 August. then choose 4 days...
OK
Now go back and choose a different date of 29th August.
The 4 days should deselect, but it doesn't until you do a further click anywhere else...
I think I need to be updating a live attr. but not sure.
to untick #spanduration
I am using:
$('input[name="duration"]').removeAttr('checked');
$("#spanduration").attr("style", "background-position: 0px 0px;");
but it is not working until you do that second click anywhere.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
也许是因为它是一个单选按钮。
尝试将其更改为复选框?
如果没有选中其他按钮,单选按钮不喜欢被取消选中:
并且独立
另一方面,复选框相互取消选中:(注意名称类似于数组)
并且独立
您可以编写类似这样的内容以具有独立复选框的能力,并且也可以分组单选按钮的优点: http://jsfiddle.net/LJJrZ/
Maybe it because its a radio button.
Try to change it to a checkbox?
Radio button dont like to be unchecked if none other is checked:
And standalone
On the other hand checkboxes uncheck each other: (note the name is array like)
And standalone
You can write something like this to have the ability of a standalone checkbox and also the sweetness of grouped radio-buttons: http://jsfiddle.net/LJJrZ/
在输入模糊之前,更改事件不会在文本输入上触发。
您可以尝试在填充日期后手动模糊输入(对于可访问性来说不太好)。或者更好的是,在填充日期后自己手动触发更改事件。例如,请
参阅此处的完整示例: http://jsfiddle.net/irama/rJGpn/
编辑:查看您的代码,看起来有机会(当您实例化日期选择器时)将其插入到回调函数中:
让我们知道您的进展!
The change event doesn't fire on a text input until the input is blurred.
You could try to manually blur the input after the date is populated (not great for accessibility). Or better yet, manually trigger the change event yourself after the date is populated. e.g.
See full example here: http://jsfiddle.net/irama/rJGpn/
EDIT: Looking at your code, it looks like there's an opportunity (when you instantiate the datepicker) to insert this into a callback function:
Let us know how you go!