-2

The WP custom post type already used jquery UI datepicker , but I need to add multidatepicker for on field. I have added

function pw_loading_scripts_wrong() {
    echo '<script src="https://cdn.rawgit.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.js">';
}
add_action('admin_head', 'pw_loading_scripts_wrong');

and

$(function() {
      $( ".datepicker").multiDatesPicker({
        minDate: 0, showButtonPanel: true, changeMonth: true, changeYear: true          
            , onSelect: function(dateText, inst) { inst.settings.defaultDate = dateText; }

      });
    });

but still not working. Please help.

1 Answer 1

0
try now this code
<?php  function load_requirements() 
{
        wp_register_script('mdp', 'https://cdn.rawgit.com/dubrox/Multiple-Dates-Picker-for-jQuery-UI/master/jquery-ui.multidatespicker.js');
        wp_enqueue_script('mdp');
}
add_action('admin_head', 'load_requirements');?>


 jQuery(document).ready(function($) 
 {
   $('.datepicker').multiDatesPicker();
 });

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.