admin管理员组文章数量:1354414
Using this:
$(function () {
$("#datepicker").datepicker({
onSelect: function (date) {
var links = "/";
window.location.href = links + date;
}
});
});
To populate a URL - unique for each day picked from the datepicker.
In this case - Google.co.uk used as an example with the data appended.
I would like to change the date format to be "ddmm" - so that clicking on 2nd January (and year) returns the link: .
I can't figure out how to change the default data formatting from mm/dd/yyyy.
Example code here >>> JSFIDDLE
Using this:
$(function () {
$("#datepicker").datepicker({
onSelect: function (date) {
var links = "http://google.co.uk/";
window.location.href = links + date;
}
});
});
To populate a URL - unique for each day picked from the datepicker.
In this case - Google.co.uk used as an example with the data appended.
I would like to change the date format to be "ddmm" - so that clicking on 2nd January (and year) returns the link: http://goolge.co.uk/0201.
I can't figure out how to change the default data formatting from mm/dd/yyyy.
Example code here >>> JSFIDDLE
Share Improve this question edited Dec 16, 2013 at 18:27 Jason P 27k3 gold badges32 silver badges45 bronze badges asked Dec 16, 2013 at 18:26 NimueSTEMNimueSTEM 3034 silver badges15 bronze badges 1- you just need to add this option dateFormat: 'ddmm' in datepicker – akbar ali Commented Dec 16, 2013 at 18:41
2 Answers
Reset to default 7$(function () {
$("#datepicker").datepicker({
dateFormat: 'ddmm',
onSelect: function (date) {
var links = "http://google.co.uk/";
window.location.href = links + date;
}
});
});
Thanks for the feedback.
I've integrated the answers into http://glengilchrist.co.uk/hwb/numday.html
The datepicker throws out the ddmm date format, which is wrapped into a full URL.
This then pushes to a site containing 366 Maths activities.
(Very rough, with not formatting)
Cheers G
本文标签: javascriptJQuery DatepickeronSelect Date FormatStack Overflow
版权声明:本文标题:javascript - JQuery Datepicker - onSelect Date Format - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744022374a2577444.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论