How to reset (clear) form through JavaScript?

Viewed 393670

I have tried $("#client.frm").reset(); but it is not working.So how to reset form via jQuery?

13 Answers

You can simply do:

$("#client.frm").trigger('reset')

Try this :

$('#resetBtn').on('click', function(e){
    e.preventDefault();
    $("#myform")[0].reset.click();
}

You could use the following:

$('[element]').trigger('reset')

Use this simple trick to reset the form

_("form_id").reset();

You can clear the whole form using onclick function.Here is the code for it.

 <button type="reset" value="reset" type="reset" class="btnreset" onclick="window.location.reload()">Reset</button>

window.location.reload() function will refresh your page and all data will clear.

Related