how to sum how many days from text fields in the 3rd textbox using datepicker
i have the following code:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>Sum Of Total Days</title>
<link rel="stylesheet" href="jquery-ui.css" />
<script src="jquery-1.9.1.js"></script>
<script src="jquery-ui.js"></script>
<script>
$(function sum() {
datepickerln1 = $( "#datepickerln1" ).datepicker().value;
datepickerln2 = $( "#datepickerln2" ).datepicker().value;
document.getElementById('#total').value = parseFloat(datepickerln2) -
parseFloat(datepickerln1) +1;
});
</script>
</head>
<body>
<p>Date 1: <input name="datepickerln1" id="datepickerln1" type="text"
onblur="sum()"/></p>
<p>Date 2: <input name="datepickerln2" id="datepickerln2" type="text"
onblur="sum()"/></p>
<input name="total" id ="total" type="text" readonly />
</body>
</html>
it is not doing sum of the total days when i put the date using datepicker
in Date 1 & Date 2.
Please help
thanks
No comments:
Post a Comment