Ticket #1286 (closed bug: fixed)
"Getting Started with jQuery" tutorial out of date
| Reported by: | schettino72 | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.1.3 |
| Component: | docs | Version: | 1.1.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I just started to use JQuery. I was folowing the tutorial "Getting Started with jQuery" and I got an error when trying to execute this example:
$(document).ready(function() {
// use this to reset a single form
$("#reset").click(function() {
$("#form").reset();
});
});
Firebug:
$("#form").reset is not a function
[Break on this error] $("#form").reset();
I checked the API (and the code) and this event is not there. I guess it should. If not, the problem is in the tutorial.
Change History
comment:2 in reply to: ↑ 1 Changed 6 years ago by brandon
- Component changed from event to docs
- Summary changed from No bind for 'reset' event to "Getting Started with jQuery" tutorial out of date
comment:3 in reply to: ↑ 1 Changed 6 years ago by MattPenner
Replying to jakecigar:
use $("#form")[0].reset() to reset your form.
I ran into this same problem and found this ticket. The tutorial needs to be updated.
In addition to jakecigar's fix for the single form use:
$("form").each(function() {
$(this)[0].reset();
});
to reset all the forms on the page as the tutorial attempts to do.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

$("#form") is a jQuery object. $("#form")[0] is the dom element. $("#form")[0].reset() resets the form.
use $("#form")[0].reset() to reset your form.