Error validating form with jQuery

前端 未结 2 1475
闹比i
闹比i 2021-01-26 14:33

I\'m getting the following error when trying to validate my form:

\'this.0.form\' is null or not an object

I\'m using the latest jQuery and jQu

相关标签:
2条回答
  • 2021-01-26 15:14

    Your jQuery selector for the form omits the # sign. The jQuery ID selector should include a # like so:

    function SubmitForm() {
        $("#UrIntakeForm").valid(); // "#UrIntakeForm" instead of "UrIntakeForm"
     }
    

    Otherwise you are applying the valid() method to an empty jQuery object, which results with the error you've specified.

    0 讨论(0)
  • 2021-01-26 15:21

    Your jQuery selector is wrong

       function SubmitForm() {
            $("#UrIntakeForm").valid();
         }
    

    add a hash (#) to the selector to identify it as an id

    0 讨论(0)
提交回复
热议问题