Opened 16 years ago
Closed 14 years ago
#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: | ||
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.
Change History (4)
comment:1 follow-ups: 2 3 Changed 16 years ago by
comment:2 Changed 16 years ago by
Component: | event → docs |
---|---|
Summary: | No bind for 'reset' event → "Getting Started with jQuery" tutorial out of date |
comment:3 Changed 16 years ago by
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.
comment:4 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Note: See
TracTickets for help on using
tickets.
$("#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.