作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我目前在我的网站上使用两个不同的日期选择器,我想只使用 jQuery 的日期选择器。
目前,这是我传递到后端 API 的当前格式:
但是,我真的很想将日期选择器附加到此输入字段。然而,通过使用 jQuery 日期选择器,我的日期变成了这样,这是发送到后端 API 的无效值:
知道如何在日期选择器关闭时将格式“07/16/14”转换为“Wed Jul 16 2014”吗?
最佳答案
您应该能够利用dateFormat
选项中提供的各种选项。完整引用可在 jQueryUI 网站上找到 - http://jqueryui.com/datepicker/#date-formats和 API 站点 - http://api.jqueryui.com/datepicker/#option-dateFormat
DM dd yy
的格式应该可以满足您的需求。
示例代码:$( ".selector").datepicker({ dateFormat: "DM dd yy"});
关于javascript - jQuery:有没有办法为 jQuery Datepicker 转换日期?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24771277/
我是一名优秀的程序员,十分优秀!