1
    <script>
           jQuery(function() {
           jQuery(document).ready(function() {
           jQuery(".date").datepicker();

             jQuery(".date").datepicker({
             onSelect: function(dateText) {
             console.log("Selected date: " + dateText + "; input's current value: " + this.value);
             jQuery(this).change();
             }
             })
             .on("change", function() {
             debugger
             var date = jQuery(this).datepicker('getDate');
             var dayOfWeek = date.getUTCDay();
             if(dayOfWeek == 5 || dayOfWeek == 6)
             {
             //your alert code
             //alert('You Have Selected Day is Saturday Or Sunday Do you wish to Continue');

             var x=window.confirm("Your Selected Date Or Day is Saturday Or Sunday \n Do you wish to Continue")
             if(x){
             window.alert("Ok!")
             }
             else
             {
             //window.close();
              jQuery(this).val("");
             }
             }
             });
             });
          });   
          </script>

    function setcal(n)
    {
    var dated= document.getElementById('inspectiondate'+n).value;
                    Calendar.setup({
                        inputField: "inspectiondate"+n,
                        ifFormat: "%Y-%m-%e",
                        showsTime: false,
                        range:"currentYear",
                        button: "Idate"+n,
                        align: "Bl",
                        singleClick : true,
                        dateStatusFunc :    function (date) { 
                                    var now= new Date();

                                    if(date.getFullYear() === now.getFullYear())
                                    { 


                                        if(date.getMonth() < now.getMonth() && date.getFullYear() == now.getFullYear())
                                        {
                                            return (true);
                                        }
                                        else
                                        {
                                             if(date.getDate() < now.getDate() && date.getMonth() == now.getMonth() && date.getFullYear() == now.getFullYear())
                                                 return (true);
                                             else
                                                 return (false);
                                        }
                                    }

                                    }


                    });                                     

    }


    <input type="text" name="inspectiondate<? echo $sno; ?>" id="inspectiondate<? echo $sno; ?>" placeholder="Date" class="required-entry date" style="width:100px !important;" readonly="readonly" autofocus require>

<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_SKIN). 'adminhtml/default/default/images/grid-cal.gif'; ?>" alt="" class="v-middle date" id="Idate<? echo $sno; ?>" title="Select Date"  onclick="setcal(<? echo $sno; ?>)">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.