Ticket #10711 (closed bug: fixed)
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
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

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