php - calculate values on basis of text box entry -
i have 1 row of text boxes generated php loop , mysql id.
<input class="text_field1" id="<?php echo $i ?>" name="q_<?php echo $row['pid']; ?>" type="text" style="width:150px" /> <input disabled="disabled" class="text_fieldd" id="p_<?php echo $row['pid']; ?>" name="p_<?php echo $row['pid']; ?>" type="text" value="<?php echo $row['pprice'] ?>" /> <input disabled="disabled" class="text_fieldd" id="t_<?php echo $row['pid']; ?>" name="t_<?php echo $row['pid']; ?>" type="text" />
what want is
when enter value in text box class text_field1, want calculate total in text box name t_.... (qty * price ,p_....)
i try code works little bit not want , jquery code is
$('.text_field1').bind("focus blur change keyup", function(){ var $el = $(this); var numpallets =isnumeric1($el.val()); });
thanks
i think should work. binded keyup in example:
$('.text_field1').keyup(function() { var pid = $(this).attr("name").split("_")[1]; // row pid var q = $(this).val() * 1; var p = $("#p_"+pid).val() * 1; $("#t_"+pid).val(q * p); });
Comments
Post a Comment