Hello I have created a table in and it have 3 columns. Now i have to multiply first values in first two columns and get that result in third column.
my visualforce page
<apex:page controller="TestCalculationController">
<apex:includeScript value="https://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js" />
<script type="text/javascript">
var j$ = jQuery.noConflict();
j$(document).ready(function(){
var i = j$('#tdi').val();
var tdd = j$('#tdd').val();
function multiply(a,b) {
return a*b ; }
var result= multiply (i,tdd) ;
j$('#res').val(result);
});
</script>
<apex:form>
<table>
<tr>
<th>IntegerValue</th>
<th>ConstValue</th>
<th>Multiplied Result</th>
</tr>
<apex:repeat value="{!intList}" var="i">
<tr class="inputs testclass" id='tr' >
<td id ="tdi">{!i}</td>
<td id ="tdd" >{!days}</td>
<td id ="res"> </td>
</tr>
</apex:repeat>
</table>
</apex:form>
</apex:page>
and my controller
public class TestCalculationController {
public integer days {
get;
set;
}
public List < Integer > intList {
get;
set;
}
public TestCalculationController() {
intList = new List < Integer > ();
days = 365;
for (integer i = 20; i <= 30; i++) {
intList.add(i);
}
}
}