0

jQuery datepicker 没有显示在我的结帐页面上,我不知道为什么。

交货日期字段出现,但当您单击日期选择器时不显示。

对于如何解决此问题的任何想法,我将不胜感激!

这是代码:

`

$wpefield_version = '1.0';

add_action('woocommerce_after_checkout_billing_form', 'my_custom_checkout_field'); 

function my_custom_checkout_field( $checkout ) {    

    wp_enqueue_script( 'jquery-ui-datepicker' );

    wp_enqueue_style( 'jquery-ui', "http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/smoothness/jquery-ui.css" , '', '', false);
wp_enqueue_style( 'datepicker', plugins_url('/css/datepicker.css', __FILE__) , '', '', true);

/*print(' <link rel="stylesheet" type="text/css" href="' . plugins_url() . '/order-delivery-date-for-woocommerce/datepicker.css">

        <script type="text/javascript" src="' . plugins_url() . '/order-delivery-date-for-woocommerce/datepicker.js"></script>'
    );
print('<script type="text/javascript" src="' . plugins_url() . '/order-delivery-date-for-woocommerce/initialize-datepicker.js"></script>');*/

echo '<script language="javascript">jQuery(document).ready(function(){
jQuery("#e_deliverydate").width("150px");
var formats = ["MM d, yy","MM d, yy"];
jQuery("#e_deliverydate").val("").datepicker({dateFormat: formats[1], minDate:1});
jQuery("#e_deliverydate").parent().after("<div id=\'order-desc\'><small style=font-size:10px;>Format (DD/MM/YY). We will try our best to deliver your order on the specified date</small></div>");

;`

4

1 回答 1

0

看看这里:http: //jqueryui.com/datepicker/ 改变这个:

echo '<script language="javascript">jQuery(document).ready(function(){
jQuery("#e_deliverydate").width("150px");
var formats = ["MM d, yy","MM d, yy"];
jQuery("#e_deliverydate").val("").datepicker({dateFormat: formats[1], minDate:1});
jQuery("#e_deliverydate").parent().after("<div id=\'order-desc\'><small style=font-size:10px;>Format (DD/MM/YY). We will try our best to deliver your order on the specified date</small></div>");

为了这:

echo '<script language="javascript">jQuery(document).ready(function(){
jQuery("#e_deliverydate").width("150px");
var formats = ["MM d, yy","MM d, yy"];
jQuery("#e_deliverydate").datepicker({dateFormat: formats[1], minDate:1});
jQuery("#e_deliverydate").parent().after("<div id=\'order-desc\'><small style=font-size:10px;>Format (DD/MM/YY). We will try our best to deliver your order on the specified date</small></div>");

确保您的 jqueryui.js 已加载。从浏览器查看控制台以查找错误。

于 2013-03-28T13:03:11.950 回答