jQuery datepicker, onSelect won't work

前端 未结 8 1842
死守一世寂寞
死守一世寂寞 2020-12-05 04:09

I can\'t get onSelect working on my jQuery datepicker.

Heres my code:



        
相关标签:
8条回答
  • 2020-12-05 04:51

    The best solution is to set the datepicker defaults

    folows the code that I used

    $.datepicker.setDefaults({
        onSelect: function () {
            $(this).focus();
            $(this).nextAll('input, button, textarea, a').filter(':first').focus();
        }
    });
    
    0 讨论(0)
  • 2020-12-05 04:57

    datePicker's onSelect equivalent is the dateSelected event.

    $(function() {
        $('.date-pick').datePicker( {
            selectWeek: true,
            inline: true,
            startDate: '01/01/2000',
            firstDay: 1,
        }).bind('dateSelected', function(e, selectedDate, $td) {
            alert(selectedDate);
        });
    });
    

    This page has a good example showing the dateSelected event and other events being bound.

    0 讨论(0)
提交回复
热议问题