how can i combine two functions in jquery?

Your deFromDate and deToDate variables are stored locally in your functions.

To use the variables outside the function you have to inizialize them outside:

var deToDate;

var deToDate;

Then assign the value inside the functions

function deFromDateChanged(s, e) {
        deFromDate = (s.GetInputElement().value)
        alert(deFromDate );
    }  

function deToDateChanged(s, e) {
        deToDate = (s.GetInputElement().value)
        alert(deToDate );
    }

and then subtract two date object

var ResultDate = Math.abs(deToDate - deFromDate); //difference in milliseconds

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top