jQuery If myform.valid() is true then fire another jQuery function?

后端 未结 3 859
予麋鹿
予麋鹿 2021-02-09 16:40

I have a jQuery function that i would like to execute only if the form validation is true
I have the validation and other jQuery working fine.
the problem is now b

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-09 17:32

    If you're using the jQuery validate plugin then the valid() method returns a boolean to indicate whether or not the form validated successfully, so you could just do:

    if ($("#myform").valid()) {
        CallSomeOtherFunction();
    }
    

提交回复
热议问题