Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 让jquery在wordpress中排队?_Php_Jquery_Wordpress - Fatal编程技术网

Php 让jquery在wordpress中排队?

Php 让jquery在wordpress中排队?,php,jquery,wordpress,Php,Jquery,Wordpress,我在向自定义wordpress插件添加jquery库时遇到了一些问题。 它告诉我它找不到变量jQuery。 非常感谢您的帮助 simplepluginclass.php包括functions.php include plugin\u dir\u path(\u文件\u)。'inc/functions.php' functions.php <?php function register_jqscripts() { wp_enqueue_script(

我在向自定义wordpress插件添加jquery库时遇到了一些问题。 它告诉我它找不到变量jQuery。 非常感谢您的帮助

simplepluginclass.php
包括
functions.php

include plugin\u dir\u path(\u文件\u)。'inc/functions.php'

functions.php

 <?php
        function register_jqscripts() {
            wp_enqueue_script('jQuery', 'http://code.google.com/apis/libraries/devguide.html#jquery');
            wp_enqueue_script('jquery-ui-core', 'https://code.jquery.com/ui/1.12.1/jquery-ui.min.js');
            wp_enqueue_script('jquery-ui-datepicker');
            wp_enqueue_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
        }


    function add_datepicker(){ ?>
    <script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('#dob').datepicker({
            dateFormat: 'dd-mm-yy'
        });
    });
    </script>
    <?php
    }
    add_action( 'register_form', 'register_jqscripts' );
    add_action('register_form','add_datepicker');

?>
 <label for="dob"><?php _e( 'Date of Birth', 'sportspress' ) ?><br />
               <input type="date" class="customdatepicker" id="dob" name="dob" />
          </label>

jQuery(文档).ready(函数(){
jQuery('#dob').datepicker({
日期格式:“dd-mm-yy”
});
});
simplepluginclass.php

 <?php
        function register_jqscripts() {
            wp_enqueue_script('jQuery', 'http://code.google.com/apis/libraries/devguide.html#jquery');
            wp_enqueue_script('jquery-ui-core', 'https://code.jquery.com/ui/1.12.1/jquery-ui.min.js');
            wp_enqueue_script('jquery-ui-datepicker');
            wp_enqueue_style('jquery-ui-css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');
        }


    function add_datepicker(){ ?>
    <script type="text/javascript">
    jQuery(document).ready(function(){
        jQuery('#dob').datepicker({
            dateFormat: 'dd-mm-yy'
        });
    });
    </script>
    <?php
    }
    add_action( 'register_form', 'register_jqscripts' );
    add_action('register_form','add_datepicker');

?>
 <label for="dob"><?php _e( 'Date of Birth', 'sportspress' ) ?><br />
               <input type="date" class="customdatepicker" id="dob" name="dob" />
          </label>

您在jQuery中引用的代码指向Google代码文档。将链接更改为指向CDN上的
jQuery
源文件:

wp_enqueue_script('jQuery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js');
您在jQuery中引用的代码指向Google代码文档。将链接更改为指向CDN上的
jQuery
源文件:

wp_enqueue_script('jQuery', 'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js');

谁在告诉你什么?谁在告诉你什么?谢谢,这就是jquery的问题。抱歉,我完全没有注意到我指的是文档。谢谢。由于某种原因,日期选择器没有在safari中加载,但它现在在chrome中工作。我想这可能是缓存问题。谢谢,这就是jquery的问题。抱歉,我完全没有注意到我指的是文档。谢谢。由于某种原因,日期选择器没有在safari中加载,但它现在在chrome中工作。我想这可能是一个缓存问题。