Bug Tracker

Opened 11 years ago

Closed 11 years ago

Last modified 11 years ago

#10711 closed bug (fixed)

For Loop Missing Opening Brace.

Reported by: [email protected] Owned by:
Priority: low Milestone: None
Component: web Version:
Keywords: Cc:
Blocked by: Blocking:

Description

Greetings, the following url: http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery

Has a bug in the example code for the "Please Rate" example. The for instruction:

for ( var i = 1; i <= 5; i++ )

is missing the opening brace bracket. The code will not parse properly.

See the example code below

$(document).ready(function() {

generate markup $("#rating").append("Please rate: ");

for ( var i = 1; i <= 5; i++ )

OPENING BRACE BRACKET MISSING HERE. START OF LOOP NOT DEFINED

$("#rating").append("<a href='#'>" + i + "</a> ");

add markup to container and apply click handlers to anchors $("#rating a").click(function(e){

stop normal link click e.preventDefault();

send request $.post("rate.php", {rating: $(this).html()}, function(xml) {

format and output result $("#rating").html(

"Thanks for rating, current average: " + $("average", xml).text() + ", number of votes: " + $("count", xml).text()

);

});

});

});

Change History (1)

comment:1 Changed 11 years ago by addyosmani

Component: unfiledweb
Priority: undecidedlow
Resolution: fixed
Status: newclosed

Thanks for pointing this out. I've just fixed it.

Note: See TracTickets for help on using tickets.