Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Fire the datepicker onselect event manually

Can anyone tell me how do you trigger the onselect event of datepicker? My code is working well (pulling some data from a database based on the value of datepickers altfield) but when the page loads it doesn't trigger the onselect event on the current date and it doesn't display anything; so I would like to do that manually.

<script>
     $( "#datepicker" ).datepicker
    (
    {
          altField: '#sheet',
          onSelect: function load() {
            $(document).ready(function() {
                    $.ajax({
                    type: 'POST',
                    url: 'test.php',
                    data: {sheetid: $('#sheet').val()},
                    success: function(data)
                    {
                        $("#content").html(data);
                    }
                });

        });
        },
          firstDay: 1});
    </script>
like image 546
user2743057 Avatar asked Sep 24 '13 10:09

user2743057


1 Answers

This is the only solution I found that also works for a datetimepicker

var $calendar =$('#from');
$.datepicker._getInst($calendar[0]).settings.onSelect()//or onClose or any event 
like image 192
scaryterry Avatar answered Oct 18 '22 14:10

scaryterry