How to call a js function onSelect event of datepicker jquery?

Rahul picture Rahul · Jun 1, 2012 · Viewed 71.1k times · Source

Please anyone help me.. I have a js function

function updateAb(param){ some manipulation }

And i am calling a datepicker jquery onselect event like..

$( ".datepicker").datepicker({onSelect: function(dateText, inst) { ... }});

I want to call the js function in select, how to do that? My objective is to get the value onselect of date from the datepicker and setting the attribute value in input field. Can anyone help me???

Answer

Kabilan S picture Kabilan S · Jun 1, 2012

Here goes ur code

$('.datepicker').datepicker({
    dateFormat: 'dd-mm-yy',
    numberOfMonths: 1,
    onSelect: function(selected,evnt) {
         updateAb(selected);
    }
});

function updateAb(value){     
    $('#yourInputID').val(value);    
}