Clear form fields with jQuery

前端 未结 30 3252
甜味超标
甜味超标 2020-11-22 15:48

I want to clear all input and textarea fields in a form. It works like the following when using an input button with the reset class:

$(\".reset         


        
30条回答
  •  无人共我
    2020-11-22 16:36

    Add hidden reset button as follows

    
    // Call reset buttons click event
    // Similar to ClearInputs('resetBtn');
    function ClearInputs(btnSelector) {
         var btn = $("#" + btnSelector);
         btn.click();
    }
    

提交回复
热议问题