在 HTMX 中使用 bootstrap-datepicker

Using bootstrap-datepicker with HTMX

我正在尝试将 bootstrap-datepicker 与 HTMX 一起使用。

关于日期更改,我想将日期用作 hx-post 的参数,但我不知道如何处理。

我有一个JSFiddle with a working bootstrap-datepicker, and am trying to post to /dateurl on the changeDate event, with the value of getDate方法。

我离得还近吗?我尝试使用 htmx 站点上的 sortable 示例作为起点。我想我不明白如何在事件触发时实际某事。

任何帮助将不胜感激。

感谢您提供这个 jsfiddle,这样玩起来很容易。

我找到了这个解决方案。

<input type="text" hx-trigger="change" hx-post="/dateurl"
       onchange="htmx.trigger(this, 'change')">

事件需要手动调度,这不太好。也许有更好的解决方案。但对我来说,如果没有 onchange 属性,它就无法工作。