Adding the datepicker in events plugin
-
Hi,
I try to add the datepicker to the date field of my plugin but I cannot make it work.
1) I enqueue scripts:
function enqueue_date_picker(){ wp_enqueue_script( 'my_script', plugins_url( '/js/script.js' , __FILE__ ), array('jquery', 'jquery-ui-core', 'jquery-ui-datepicker'), '1.0', true ); wp_enqueue_style('my_style', 'https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css'); } add_action( 'admin_enqueue_scripts', 'enqueue_date_picker' );
2) My input field:
<input class="widefat" id="date" type="text" name="date" value="<?php echo date( 'j F Y', $event_date ); ?>" />
3) Added file called script.js in folder /js with content:
$(function() { $( "#date" ).datepicker(); })( jQuery );
I notice all scripts are loaded in head section of backend.
My .js script file is loaded in footer section.
Nothing happens when I click the date field.
So what am I doing wrong here?Have a nice weekend!
Guido
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding the datepicker in events plugin’ is closed to new replies.