Similar to the validate-method, the rules method works with just one
element. This should work as a workaround:

$(".euro").each(function() {
  $(this).rules("add", "digits")
});

Jörn

On Mon, Jul 6, 2009 at 12:39 PM,
macronom<marcus.stratm...@googlemail.com> wrote:
>
> Hi,
>
> I am trying to use
>
> $(".euro").rules("add", "digits")
>
> for my form but it seems that only the first matching input field with
> class "euro" is being validated using the rule "digits". my form looks
> like this:
>
> <input name="costs[1]" value="" class="euro">
> <input name="costs[2]" value="" class="euro">
> ...
>
> This is a generated form with a changing number of input fields so I
> thought it would be the best to use a class for all fields to apply a
> validation rule. But apparently the rule is only applied to the first
> input field when using the code above. I'm not sure if this is a bug
> or if I just understand something wrong.
> What is the recommended way to apply a rule to a changing number of
> objects?
>
> Thanks,
> Marcus
>

Reply via email to