-2

我一直在尝试在 div 和两个 texbox 中显示日期选择器的值。我可以在普通的 PHP 文件中执行此操作,但是当我尝试在 wordpress 网站中执行此操作时。它没有发生我正在使用的 jquery 代码如下:

jQuery(function() {
         jQuery('#ui-datepicker-div').datepicker({
             altField: '#wc_order_field_2563', //setting alternate field
             onSelect: function(dateText, inst) {
                    $('#show_pickupdate_input').val(dateText);
                    $('#pickupdate_text').text(dateText);
                 //alert(dateText);
                }
         });
    });

如果你想看到它的实际效果,你可以在twomoms.kitchen结帐页面上看到它。但是,无论我做什么,这似乎都不起作用。

请让我知道我做错了什么:(

4

1 回答 1

0

通过使用下面的代码更改上面的代码,问题得到了解决。此修改是在使用根据需要添加任何字段的插件添加日期选择器时完成的。下面的代码使用其他文本框中的更改来更改 div 和文本框。

jQuery(function() {
         jQuery('#wc_order_field_2563').datepicker({
             onSelect: function(dateText, inst) {
                    $('#show_pickupdate_input').val(dateText);
                    $('#pickupdate_text').text(dateText);
                 //alert(dateText);
                }
         });
    });
于 2018-02-08T08:07:12.933 回答