我已經stucked這個問題。 datepicker在靜態內容上工作正常。DatePicker不能在Ajax加載內容
但是,當通過Ajax加載內容時失敗。
我曾嘗試: -
jQuery.noConflict();
jQuery(function($) {
$(document).ready(function(){
$(".datepickerRange").datepicker({
dateFormat: 'dd-mm-yy',
prevText:'',
nextText:'',
minDate: 0,
maxDate: "+1M",
showOn: "button",
buttonImage: divadatepicker.image_url+"/calendar.jpeg",
buttonImageOnly: true
});
$(".datepicker").datepicker({
dateFormat: 'dd-mm-yy',
prevText:'',
nextText:'',
showOn: "button",
buttonImage: divadatepicker.image_url+"/calendar.jpeg",
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
yearRange: "1960:2015"
});
});
$(document).live(function(){
$(".datepickerRange").datepicker({
dateFormat: 'dd-mm-yy',
prevText:'',
nextText:'',
minDate: 0,
maxDate: "+1M",
showOn: "button",
buttonImage: divadatepicker.image_url+"/calendar.jpeg",
buttonImageOnly: true
});
$(".datepicker").datepicker({
dateFormat: 'dd-mm-yy',
prevText:'',
nextText:'',
showOn: "button",
buttonImage: divadatepicker.image_url+"/calendar.jpeg",
buttonImageOnly: true,
changeMonth: true,
changeYear: true,
yearRange: "1960:2015"
});
});
});
它沒有顯示通過AJAX加載的內容後,甚至壓延小圖片。
僅供參考,'$ .live()'是因爲1.7棄用,在1.9移除。使用'$。對()',而不是http://api.jquery.com/on/ – jammypeach