The way I would do this is get all inputs with a name beginning with
'total' then use .each:

// save jQuery object for later use
$totals = $("[EMAIL PROTECTED]");
$totals.each( function() {
  // get letter
  var letter = this.name.substr(5);
  if(letter == "A") this.value = "Total A";
});

On Aug 28, 5:00 am, Brett <[EMAIL PROTECTED]> wrote:
> Hello there, I've been loving jQuery so far - so efficient, and a
> great piece of code to work with.
>
> I was wondering if it is possible to use jQuery in a loop where I need
> to set a row of values in.
> For example if there was a set of input boxes named totalA - totalE.
> To change the first,  I would use:
> $("[EMAIL PROTECTED]'totalA']").val("the value I want to put on this
> form");
>
> But is there a way I can make @name a variable, or a combination of
> strings?
> @name='total' + currentLetter      Does not work like I thought it
> would have..
> I think there is something fundamentally wrong that I'm doing...

Reply via email to