petritr
11 months ago

HTML5 validation multiple forms

Posted 11 months ago by petritr

I need to validate multiple forms in the same page on one button click.

I have the following but it's working only for the first from and not for the rest

    if ($("#save_device").length > 0 ) {
        if (!$("#save_device")[0].checkValidity() ) {
            $("#save_device").each(function(){
                $(this).find("#submit-new-hidden").click();
            });
        }
    }

I have multiple forms with the name save_device and multiple buttons with the id submit-new-hidden

How can i validate all forms at once ?

Please sign in or create an account to participate in this conversation.