<script type="text/javascript">
function duedatecal(){
var dmy = $(".invoicedate").val().split("/");
alert(dmy); // it is in the format of mm/dd/yyyy
var invoicedate = new Date(
parseInt(dmy[2], 10),
parseInt(dmy[1], 10) - 1,
parseInt(dmy[0], 10)
);
alert(invoicedate.getDate()); //Getting the month Value but need to get the date value
var paymentterms = $(".paymentterms").text();
alert(paymentterms);
var dueDate = new Date();
dueDate.setDate(invoicedate.getDate()+parseInt(paymentterms)); //need to add paymentterms to date but here adding to the month
alert(dueDate);
$(".duedate").html(dueDate); //not getting the output displayed
}
</script>
<apex:form>
Date:
<Apex:inputtext value="{!dateIn}" id="time" styleclass="invoicedate" onblur="duedatecal();"/> //say suppose date is 06/03/2013
Payment Days:
<apex:outputtext value="{!payment.Net__c}" styleclass="paymentterms" /> //say suppose will get 10 days here
Due date:
<apex:outputtext value="{!duedate}" styleclass="duedate"/> // output shld be 16/03/2013
</apex:form>
Here the {!duedate} is not getting displayed in the outputtext(Added all the errors I'm facing in javascript code).Where I went wrong?