Bug Tracker

Ticket #10711 (closed bug: fixed)

Opened 3 years ago

Last modified 3 years ago

For Loop Missing Opening Brace.

Reported by: justin.m.julian@… Owned by:
Priority: low Milestone: None
Component: web Version:
Keywords: Cc:
Blocking: Blocked by:

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

comment:1 Changed 3 years ago by addyosmani

  • Priority changed from undecided to low
  • Resolution set to fixed
  • Status changed from new to closed
  • Component changed from unfiled to web

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

Note: See TracTickets for help on using tickets.