How to make AjaxForm work with several forms loaded using jquery load()?

前端 未结 2 374
花落未央
花落未央 2021-01-22 18:44

I have a page with a div that is dynamically filled using a paginator ;-) At page init I load the first 10 forms in it using jquery .load() method.

What I\'d like to do

2条回答
  •  轮回少年
    2021-01-22 19:14

    ID values are unique to a single DOM element. So you'd need to give each form a new ID, so if you had three forms, you could name them like so:

    Now you'd create instances of your ajax request like so:

         $('#formone, #formtwo, #formthree').ajaxForm({
           beforeSubmit: showLoader,
           success: hideLoader
         }); 
    

提交回复
热议问题