jQuery .submit() not triggering

前端 未结 2 707
失恋的感觉
失恋的感觉 2021-01-03 10:00

I\'ve done a lot of searching but can\'t find out why my jQuery .submit() will not trigger. I\'ve also tried with .click() for the submit button.

2条回答
  •  一生所求
    2021-01-03 10:23

    For dynamically generated elements, you should delegate the events, you can use the on method, try the following:

    $(document).ready(function() {
        $(document).on('click', 'input[type=submit]', function() {
            alert('test');
            return false;
        });
    });
    

提交回复
热议问题