JQuery-Validation - using rules method on selected ID, why does the name attribute have to be present on the element?

后端 未结 2 1349
挽巷
挽巷 2020-12-20 03:04

I\'m a little confused about the JQuery validation plugin behavior.

If I have the following JQuery:

$(\'#form1\').validate({
    /* other validation          


        
2条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-20 03:41

    A name attribute is required on the element firstly because that's what jQuery validate uses internally as a key for each field, and secondly because the name attribute is required on input elements to ensure the page validates to the specified DOCTYPE.

提交回复
热议问题