[jQuery] each help
[jQuery] each help
Hi,
I have this in each row (a couple of rows...)
<input type="text" class="num" name="qty[]" value=""
onkeyup="javascript:test();" />
<input type="text" class="num" name="price[]" value=""
onkeyup="javascript:test();" />
<input type="text" class="num" name="row_sum[]" value="" disabled />
i'd like to calculate the data
function test(){
$("input[@type=text]").each(function(i){
var price = $("input[@name='price[]']").val();
var qty = $("input[@name='qty[]']").val();
res = price * qty;
$("input[@name='row_sum[]']").val(res);
});
}
but the function doesn't function ;) Help anyone? someone?