jQuery - Cancel form submit (using “return false”?)?

后端 未结 12 1637
盖世英雄少女心
盖世英雄少女心 2020-12-19 04:00

I\'m running into a bit of trouble while trying to cancel the submit of a form. I\'ve been following this tutorial (even though i\'m not making a login script), and it seems

12条回答
  •  死守一世寂寞
    2020-12-19 04:27

    The form you're trying to access might be dynamically added to your page. You need to use delegate to access that form in that case

    Example:

        $(document).delegate("#myform","submit",function(){
           return false;
    });
    

提交回复
热议问题