Javascript jQuery日期选择器在jQuery对话框中不工作
jQueryDatePicker在静态页面上运行良好,但在jQuery对话框页面上无法运行。这是一个wordpress网站 我知道所有必要的都包括在内,因为它在静态页面上工作。单击按钮将触发对话框页面 这是静态页面上的代码(工作):Javascript jQuery日期选择器在jQuery对话框中不工作,javascript,jquery,wordpress,dialog,jquery-ui-datepicker,Javascript,Jquery,Wordpress,Dialog,Jquery Ui Datepicker,jQueryDatePicker在静态页面上运行良好,但在jQuery对话框页面上无法运行。这是一个wordpress网站 我知道所有必要的都包括在内,因为它在静态页面上工作。单击按钮将触发对话框页面 这是静态页面上的代码(工作): 任何帮助都将不胜感激。(我是新手…通过以下方式更新您的jquery代码 $(document).ready(function($) { $('body').on('focus',".datepicker", function(){
任何帮助都将不胜感激。(我是新手…通过以下方式更新您的jquery代码
$(document).ready(function($) {
$('body').on('focus',".datepicker", function(){
$(this).datepicker({
dateFormat : 'mm/dd/yy'
});
});
});
您还可以向我们展示用于创建对话框的代码吗?当您在其回调中打开对话框时,请添加日期选择器代码。这是因为当您第一次运行代码时,jquery还看不到对话框datepicker。比如说,如果你有一个调用opendialog()的按钮,或者之后再运行datepicker()函数,而不是ready()的乐趣
<input type="text" value="" data_original_for_sale_date="" id="for_sale_date" class="datepicker">
jQuery(document).ready(function($) {
$('.datepicker').datepicker({
dateFormat : 'mm/dd/yy'
});
});
$(document).ready(function($) {
$('body').on('focus',".datepicker", function(){
$(this).datepicker({
dateFormat : 'mm/dd/yy'
});
});
});