I might be off base here but your recalc function code looks like you are expecting a loop to occur through all of the $("input[name^=module-]")

I don't think this will occur without using $.each or a "for" loop therefore you won't get any incrementation in "i". Also I've never seen "i=++", more common syntax is "i++" for incrementing "i"

starting with something like :

$("input[name^=module-]").each( function(i) {
       $(this).bind("keyup".....

will loop through each and add increment to "i" on each loop


betweenbrain wrote:
Hi All,

I'm trying to use jquery.calculation to calculate some text inputs
versus a selected field. I'm running into an issue with using
variables to select information from the same row. Here's what I have
so far. Any help would be greatly appreciated:

<script type="text/_javascript_">
	$(document).ready(
		function (){
			$("input[name^=module-]").bind("keyup", recalc);
			$("input[name='input-positions']").bind("click", recalc);
			recalc();
		}
	);

	function recalc(){
	var i = $(this)[0].rowIndex;
		$("[id=total-positions-left]").calc("avail - (used * qty)",
			{	avail: $("[name='input-positions']:checked").val(),
				used: $("[td.item-qty-pos-reqd'].eq(i)"),
				qty: $("input[id^='module-qty'].eq(i)")
			}),
		i = ++
			$("#total-positions-left").text($this.sum()
				);
			}
	</script>

  

Reply via email to