Can't get jquery to work in Admin

  • I have a custom metabox for posts which I need to be a date field on the backend for editors.

    My plugin starts with the following code to enqueue jquery:

    
    function load_datepicker() { 
        wp_enqueue_script('jquery-ui-datepicker');
        wp_enqueue_style('jquery-style', 'https://ajax.googleapis.com/ajax/libs/jqueryui/1.12.1/themes/smoothness/jquery-ui.css');
    }
    add_action( 'admin_enqueue_scripts', 'load_datepicker' );
    

    But it does not work – my field shows up but the datepicker does not show when you click on it.

    However, if I activate the classic editor plugin my code works perfectly.

    What do I need to change to make this work in gutenberg (without the classic editor plugin)?

  • Hi there,

    I checked your site and it appears you’re in the wrong forum. Although your site is connected to WordPress.com via Jetpack, it is using the open source WordPress.org software and you need to seek help at these forums:

    https://wordpress.org/support/forums/

    These forums are for WordPress.com hosted sites only. Since we do not have access to self-hosted WordPress.org sites, we are unable to provide any direct assistance to your issue. I would reach out to your site host for help.

    If you want to know more about the differences between WordPress.com and WordPress.org you can read this document:

    WordPress.com vs. WordPress.org

    Thanks!

  • The topic ‘Can't get jquery to work in Admin’ is closed to new replies.