Skip to content Skip to sidebar Skip to footer

How To Calculate Date Difference In Html Using Java Script Without Clicking Submit Button

I am giving two dates manually in the form after that one more empty box is there date difference should get calculated in terms of days in third box dynamically using java script

Solution 1:

Actually, the code works...the only thing you need is to give the form the name you use in the script

<formname="dateform">

....i tested it on your fiddle, it works like a charm: http://jsfiddle.net/byJKg/5/ ...tough you might want to check if the datediff is not NaN

if(!isNaN(days)){
   dateform.difference.value = days;
}

[edit] ...i just saw it wasn't your fiddle....but the fiddle posted by Felix Lahmer, with your source code

Post a Comment for "How To Calculate Date Difference In Html Using Java Script Without Clicking Submit Button"