How to Reset HTML Form using jQuery

Reset button makes life easier but can be disastrous if you accidentally click on it. opps.

1. Create the reset button in HTML:
<input type ="reset" id="reset" value="Reset"/>
// id and value is your own choice. Value is what that appears on the button.

2. In your javascript:
//’#reset’ is the id that you set.

Note: (Special thanks to Michael for explanation on this little jQuery magic.) [0] is because it is getting a list from the selector. So now it is getting the zeroth item from the selector.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s