I have a pageblocktable with one editable column in which numeric value for quantity will be entered. the next column to this is the Rate column which will have values from Salesforce. I want the Product of these 2 to be displayed in the last column as Total and also the sum of the Total column in Javascript so that on entering values in the inputtext, the total dynamically changes.
Below is my page :
<apex:page controller="DetailController" sidebar="false" id="pg">
<script>
function findTotal(){
alert(document.getElementById('pg:frmId:pb:pbt:0:qty').value);
// alert(document.getElementById('pg:frmId:pb:pbt:0:j_id38').txt);
var qty = document.getElementById('pg:frmId:pb:pbt:0:qty').value;
var rate = document.getElementById('pg:frmId:pb:pbt:0:j_id38').text;
var totallineItem = qty*rate;
// document.getElementById('pg:frmId:pb:pbt:0:qty').value
document.getElementById("pg:frmId:pb:pbt:0:j_id26").innerHTML = totallineItem ;
}
</script>
<apex:form id="frmId">
<apex:pageBlock title="Order Line Items" rendered="{!showDetails}" id="pb">
<apex:pageblockButtons location="bottom">
<apex:commandButton action="{!createOrder}" value="Save"/>
</apex:pageblockButtons>
<apex:pageBlockTable value="{!DispWrapper}" var="dw" id="pbt">
<apex:column value="{!dw.lineItemObj.Product__c}"/>
<apex:column value="{!dw.lineItemObj.Order__c }"/>
<apex:column headerValue="Delivered Quantity" >
<apex:inputtext value="{!dw.quantity}" id="qty" onchange="findTotal();" styleClass="count-me"/>
</apex:column>
<apex:column value="{!dw.lineItemObj.Rate__c }" id="rate"/>
<apex:column headerValue="Total">
<apex:outputtext id="litotal"></apex:outputtext>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
</apex:form>
</apex:page>
I am not familiar with Javascript and so this code is all I have which I tried. Please point me in the right direction to proceed with this!
The sample image below shows a typical table. The last column and the summary (Totals) need to be populated via Javascript.

console.logcalls to the above code as the most simple debugging technique. But if you are going to write JavaScript you need to learn about debugging techniques for it e.g. How do I start to debug my own Visualforce/JavaScript? as most of us makes mistakes when writing it. – Keith C Aug 01 '16 at 10:20apex:facet name="footer"to add agrandTotalMarkercell at the bottom of the total column. – Keith C Aug 01 '16 at 10:41defaultedFloatfunction to answer. – Keith C Aug 01 '16 at 11:17apex:inputHiddennext to thetotalMarkerfield and also update that (using thevalfunction). Or you can just repeat the calculation at the server side as its trivial. – Keith C Aug 01 '16 at 11:41noConflictisn't necessary when using closures. – Adrian Larson Aug 01 '16 at 13:41noConflictfunction restores the value of$that jQuery has set to itself usingwindow.$ = _$. So executing the function immediately after jQuery is pulled in is the safe approach (though rarely necessary). – Keith C Aug 01 '16 at 13:47window.$within the closure. So it's not necessary. – Adrian Larson Aug 01 '16 at 13:48