How to reset a form using jQuery with .reset() method

前端 未结 16 1319
清酒与你
清酒与你 2020-11-22 17:28

I had working code that could reset my form when I click on a reset button. However after my code is getting longer, I realize that it doesn\'t work anymore.



        
16条回答
  •  Happy的楠姐
    2020-11-22 17:44

    You can just add an input type = reset with an id = resetform like this

    
    

    then with jquery you simply use the .click() function on the element with the id = resetform as follows

    
    

    and the form resets Note: You can also hide the reset button with id = resetform using your css

    
    

提交回复
热议问题