Clear and reset form input fields

前端 未结 12 1944
小蘑菇
小蘑菇 2020-11-28 22:36

I have a form containing various input fields and two buttons; one for submitting and one for cancelling.

12条回答
  •  北海茫月
    2020-11-28 23:15

    Very easy:

    handleSubmit(e){
        e.preventDefault();
        e.target.reset();
    }
    
      ...
    

    Good luck :)

提交回复
热议问题