My problem is this, I have this code:
<script language="javascript">
$(document).ready(function(){
$('#simular').each(function(){
$(this).click(function(){
$("input[name=proteina2],input[name=quantidade2]").each(function(){
var proteina2 = Number($(this).val());
if (!isNaN(proteina2)) prot = proteina2;
alert(prot);
});
});
});
});
</script>
It takes values from fields named "protein2" and "quantity2" that loop in php showing values ... What I need is not too hard I believe, but since I'm new to Jquery, I wanted some help to understand this part better. I wanted to get the values from the field "protein2" and "quantity2" and add it up separately and get all the values of the loop for those fields. For example, I have there:
Proteina2 | quantidade 2
5 10
4 2
In case what I need is to get the whole loop of "protein2" and add it with "quantity2" and it would generate the following result:
resultado: 15
resultado: 6