onsubmit refresh html form

前端 未结 5 740
春和景丽
春和景丽 2021-01-12 00:54

I\'m trying to use Javascript to submit the form\'s data. Here\'s the html.

//input fields here
5条回答
  •  清歌不尽
    2021-01-12 00:59

    Keep your js out of the DOM.

    //input fields

    JQuery:

    $('#myform').submit(function(event){
        alert('submitted');
        event.preventDefault();
    });
    

提交回复
热议问题