Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I refresh a form JQuery

Tags:

jquery

How can I refresh or reload a form using JQuery?

I am filling my form using session values. Using Jquery Post I unset session, but then the values are already filled in the form.

I am trying to reset all form values after un setting the session with the following code:

$('#form')[0].reset();   

Yet it is not working after the $post ajax call.

like image 219
zod Avatar asked Sep 21 '10 17:09

zod


1 Answers

Do you have this?

<form id="form">.....</form>

If you do, it should work. If you don't have an "id" for your form tag, you should use

$("form")[0].reset();
like image 53
sabanito Avatar answered Oct 13 '22 06:10

sabanito