Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can you trigger the jquery datepicker function in Struts?

I would like to trigger an event in jquery datepicker ,but when i select a particular date ,its not been triggered.

This is my code for validation of the from date and to date, what should I do to make this function active?

$("#fromDate").datepicker({            
    numberOfMonths: 1,
    onselect: function (selected) {
        alert("hello");
        var dt = new Date(selected);
        dt.setDate(dt.getDate() + 1);
        $("#toDate").datepicker("option", "minDate", dt);
    }
});

$("#toDate").datepicker({
    numberOfMonths: 1,
    onselect: function (selected) {
        var dt = new Date(selected);
        dt.setDate(dt.getDate() - 1);
        $("#fromDate").datepicker("option", "maxDate", dt);         
    }
});
like image 269
Coder Avatar asked Mar 10 '26 21:03

Coder


1 Answers

You have to write the function properly. It's onSelect, with an uppercase 'S'

like image 129
Gandar Avatar answered Mar 14 '26 03:03

Gandar



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!