How to clear a form?

后端 未结 11 670
清歌不尽
清歌不尽 2020-12-03 01:34

For example I have a form like this:

11条回答
  •  无人及你
    2020-12-03 01:44

    You can do something similar to this in JS and call it from onclick within your button:

    function submit() {
      $('#fieldIdOne').val('');
      $('#fieldIdTwo').val('');
    }
    

    And then in your HTML file:

    
    

    If you happen to use this solution with Firebase, it actually won't send anything to the database unless you add return false right after the call.

提交回复
热议问题