• Hi,

    i am wirting jquery in my plugin but jquery is not loading

    function hs_bookingengine(){
    wp_enqueue_script(‘jquery’);
    wp_enqueue_script(‘jquery-ui-datepicker’);
    ?>
    $(function() {
    $( “#sd” ).datepicker({
    dateFormat: “dd/mm/yy”,
    //minDate: +1,
    showOn: “both”,
    buttonImage: “https://jqueryui.com/resources/demos/datepicker/images/calendar.gif”,
    buttonImageOnly: true,
    showAnim:”slide”,
    changeMonth:true,
    changeYear:true,
    showButtonPanel:true,
    closeText:”Close”,
    beforeShow: function(){
    // this gets today’s date
    var theDate = new Date();
    theDate.setDate(<?php echo $checkin ?> + 2);
    // set min date as 2 days from today
    $(this).datepicker(‘option’,’minDate’,theDate);
    },
    // When datepicker for start date closes run this function
    onClose: function(){
    // this gets the selected start date
    var theDate = new Date($(this).datepicker(‘getDate’));
    // this sets “theDate” 1 day forward of start date
    theDate.setDate(theDate.getDate() + 1);
    // set min date for the end date as one day after start date
    $(‘#ed’).datepicker(‘option’,’minDate’,theDate);
    }
    });

    $(‘#ed’).datepicker({
    dateFormat: “dd/mm/yy”,
    showOn: “both”,
    buttonImage:”https://jqueryui.com/resources/demos/datepicker/images/calendar.gif&#8221;,
    buttonImageOnly: true,
    showAnim:”slide”,
    changeYear:true,
    changeMonth:true,
    beforeShow: function(){
    // this gets today’s date
    var theDate = new Date($( “#sd” ).datepicker(‘getDate’));
    // sets “theDate” 2 days ahead of today
    theDate.setDate(theDate.getDate() + 1);
    // set min date as 2 days from today
    $(this).datepicker(‘option’,’minDate’,theDate);
    },
    onClose:function(){

    }

    });

    $(“#sd”).datepicker(“setDate”, “<?php echo isset($_POST[“check_in”]) ? $_POST[“check_in”] : ‘0’ ?>”);
    $(“#ed”).datepicker(“setDate”, “<?php echo isset($_POST[“check_in”]) ? $_POST[“check_out”] : ‘1’ ?>”);

    })
    <?php

    but i am not getting datepicker in my plugin please help me

  • The topic ‘jquery not loading in rhe plugin’ is closed to new replies.