Disable submit functionality for all forms on a HTML page

前端 未结 8 1535
轻奢々
轻奢々 2021-01-02 00:04

Using the .NET Windows Forms WebBrowser control to show the preview of a page, I\'m using the following approach described in this SO posting to disable all links on the pag

8条回答
  •  渐次进展
    2021-01-02 00:41

    If you want to prevent just form submits:

    I think that best approach to just prevent

    from sending anything to anywhere is to:

    $('form').submit( function(e){ 
        e.preventDefault();
    });
    

    This disables all forms on page, no need to do individually for every form.

    JSFiddle demonstration enable/disable form submit:

    http://jsfiddle.net/cDLsw/6/

提交回复
热议问题