Skip to main content

Bug Tracker

Side navigation

#1286 closed bug (fixed)

Opened June 09, 2007 12:12PM UTC

Closed January 18, 2009 03:43AM UTC

"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:
Blocked by: Blocking:
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.

Attachments (0)
Change History (4)

Changed June 10, 2007 07:32AM UTC by jakecigar comment:1

$("#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.

Changed June 15, 2007 05:41AM UTC by brandon comment:2

component: eventdocs
summary: No bind for 'reset' event"Getting Started with jQuery" tutorial out of date

Replying to [comment:1 jakecigar]:

$("#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.

In addition to what Jake said the API was cleaned up a while back and it looks like maybe the tutorial hasn't been updated.

Changed June 27, 2007 10:31PM UTC by MattPenner comment:3

Replying to [comment:1 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.

Changed January 18, 2009 03:43AM UTC by dmethvin comment:4

resolution: → fixed
status: newclosed