element is a jQuery object, try element[0].name or element.attr("name")

Jörn

On Tue, Jun 24, 2008 at 6:11 AM, pixelyzed <[EMAIL PROTECTED]> wrote:
>
> OK, after reading the docs a little more closely I came up with the
> following which I added to the code above and which AFAIK should work:
>
> var loginValidator = $("#inscriptTalentProfessionnel").validate(
>  {
>  errorElement: "div",
>  onsubmit: true,
>  onfocusout: true,
>  errorPlacement: function(error, element) {
>    if (element.name == "vfSexe") {
>        error.insertAfter("input[value=F]");
>    } else if (element.name == "vsfSecteur2") {
>      error.insertBefore("input[value=film");
>    } else if (element.name == "vfFamille_metier") {
>      error.insertBefore("input[value=administrateur]");
>    } else {
>      error.insertAfter(element);
>   }
> }, ... on to messages, etc
>
> But for some reason the "element.name" expression always comes up as
> undefined and only the last else is executed placing the error message
> at the default "after". What am I missing that "element,name" is
> always undefined?
>
> Thanks in advance for any pointers anyone can provide.
>

Reply via email to