Reputation: 189
<script type="text/JavaScript">
$(document).ready(function(){
$("#selecctall").change(function(){
<% int j =0; %>
var current = 0;
$.each($("input[name='deferral']"),function(){
if($('#deferral'+current).is(':checked')){
current++;
<% j ++; %>
alert(<%= j %>);
}else{
$('#deferral'+current).prop('checked', true);
<%if(j< rowid.size()){%>
function($(this).val(),'<%= (String)vendor.get(j)%>','<%= (String)invoice.get(j)%>', current)
alert(<%= j %>);
<%}%>
current++;
<% j ++; %>
}
});
});
});
</script>
In above code I tried to increase the value of 'j' but it is not increasing.
otherwise I want to "(String)vendor.get(j)" this function should accept JavaScript variable i.e. 'current',but how can I convert 'current' JavaScript variable into java integer
Upvotes: 0
Views: 455
Reputation: 163
you cannot put java coding inside javascript can yos add a more information about j where is j is coming from the i will help you
this would be some thing like this firs you have to get the value of j then increment it
<script type="text/JavaScript">
$(document).ready(function(){
$("#selecctall").change(function(){
var j=$('#from some where').val();// you have to get the value of j from somewhere
j++;//them increment it
var current = 0;
$.each($("input[name='deferral']"),function(){
if($('#deferral'+current).is(':checked')){
current++;
<% j ++; %>
alert(<%= j %>);
}else{
$('#deferral'+current).prop('checked', true);
<%if(j< rowid.size()){%>
function($(this).val(),'<%= (String)vendor.get(j)%>','<%= (String)invoice.get(j)%>', current)
alert(<%= j %>);
<%}%>
current++;
<% j ++; %>
}
});
});
});
</script>
Upvotes: 1