2012-11-16 178 views

回答

3

嘗試TBIS,

$("input[name=date]").datepicker({ 
    dateFormat: "dd MM", 
    onSelect: function(dateText, inst) { 
     var dateArr = dateText.split(' ') 
     var suffix = ""; 
     switch(inst.selectedDay) { 
      case '1': case '21': case '31': suffix = 'st'; break; 
      case '2': case '22': suffix = 'nd'; break; 
      case '3': case '23': suffix = 'rd'; break; 
      default: suffix = 'th'; 
     } 

     $("input[name=date]").val(dateArr[0] + suffix +' '+ dateArr[1]); 
    } 

}); 

演示:http://jsfiddle.net/nmtcj/2/

+0

完美!謝謝! – user1738017