如何提醒所选日期名称?示例’星期一’.
@H_404_16@解决方法
因此,当您选择2011年6月7日时,它将提醒“星期二”
<script> $(function() { $( "#date" ).datepicker({ dateFormat: 'dd/mm/yy',onSelect: function(dateText,inst) { // how can i grab the day name of the day,example "Monday" and alert it out? // alert( ? ); } }); }); </script>
jQueryUI的Datepicker附带了一个
formatDate
功能,可以为你做到这一点.如果您使用的是本地化版本,它也会显示该语言的日期.
onSelect: function(dateText,inst) { var date = $(this).datepicker('getDate'); alert($.datepicker.formatDate('DD',date)); }
有关Dapicker实用程序功能本地化的更多信息,请查看http://jqueryui.com/demos/datepicker/.