开发者

Date picker click event required instead of select

开发者 https://www.devze.com 2023-02-20 12:28 出处:网络
I used a jQuery datepicker in my application. $(\'#button\').datepick({ onSelect : showStartDate }); 开发者_JAVA百科

I used a jQuery datepicker in my application.

$('#button').datepick({
    onSelect : showStartDate
});
开发者_JAVA百科

in datepick.js they have written the code for onselect:

var onSelect = inst.get('onSelect');
if (onSelect && !keyUp) {
    inst.inSelect = true; // Prevent endless loops
onSelect.apply(target, [inst.selectedDates]);
}

Now I want to change that to OnClick event only. Any help??


The documentation states that the onSelect event:

" Allows you to define your own event when the datepicker is selected. The function receives the selected date as text and the datepicker instance as parameters. this refers to the associated input field. "

$('.selector').datepicker({
   onSelect: function(dateText, inst) { 
       //create custom event to handle datepicker select
   }
});

If you are looking to make it so that the datepicker does not show unless it is clicked, you want to reference the showOn option.

$('.selector').datepicker({
    showOn: 'button'
})


Why can't you just use

$('#button').click(function(){alert('clicked');});

What is it your trying to do? Handel the click on a date? or handel the click on the datePicket DOM element

0

精彩评论

暂无评论...
验证码 换一张
取 消