Skip to main content

Bug Tracker

Side navigation

#10711 closed bug (fixed)

Opened November 08, 2011 02:18AM UTC

Closed November 08, 2011 11:18AM UTC

Last modified March 09, 2012 08:45PM UTC

For Loop Missing Opening Brace.

Reported by: justin.m.julian@gmail.com 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()

);

});

});

});

Attachments (0)
Change History (1)

Changed November 08, 2011 11:18AM UTC by addyosmani comment:1

component: unfiledweb
priority: undecidedlow
resolution: → fixed
status: newclosed

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