更改事件从刺激JS未接收的Bootstrap-datepicker
是否有可能触发 signulus js js /uxsolutions/bootstrap-datepicker“ rel =“ nofollow noreferrer”> bootstrap-datepicker ? (我正在通过 bootstrap-datepicker-rails
)
$(document).on('changeDate', '#my_form .datepicker', function(e) {
更改
事件也会在jQuery中触发(添加在这里a>?) 因此,更改将
更改为更改上面的更改
工作相同。
但是更改
事件没有在刺激中触发,例如我的datepicker文本字段:
data: { action: 'change->next-date#submit' }
不是在控制器中触发提交方法。 输入
如果输入文本,将触发事件,但这不是datePicker触发的事件。 是否应该在此处更改
事件对刺激不起作用?
Is it possible to trigger stimulus js from bootstrap-datepicker?
(I'm using it via bootstrap-datepicker-rails)
In my old jQuery code the changeDate event is triggered no problem:
$(document).on('changeDate', '#my_form .datepicker', function(e) {
The change
event also gets triggered in jQuery (added here?)
So changing changeDate
to change
above works the same.
But the change
event is not being triggered in Stimulus, EG on my datepicker text field:
data: { action: 'change->next-date#submit' }
isn't triggering the submit method in the controller. The input
event will trigger if you enter text, but this is not the event triggered by the datepicker.
Should the change
event not work here for Stimulus?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在刺激控制器的
connect()
方法中添加此方法来触发更改
事件:这将数据action属性挂钩进入刺激方法:
将钩子挂接到刺激方法中
Adding this in the stimulus controller's
connect()
method works to trigger thechange
event:This enables a data-action attribute hook into a stimulus method:
to hook into a stimulus method