Bug Tracker

Opened 7 years ago

Closed 7 years ago

#12842 closed bug (notabug)

Incorrect information in jQuery: The Basics tutorial example

Reported by: anonymous Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.8.2
Keywords: Cc:
Blocked by: Blocking:

Description

In the section - Complete Example - the follow sentance should refer to <body> instead of <head>.

Also, while the custom script is included in the <head>, it is generally preferable to place it in a separate file and refer that file with the script element's src attribute

<!DOCTYPE html> <html lang="en"> <head>

<meta charset="utf-8"> <title>jQuery demo</title>

</head> <body>

<a href="http://jquery.com/">jQuery</a> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js"></script> <script>

$(document).ready(function(){

$("a").click(function(event){

alert("As you can see, the link no longer took you to jquery.com"); event.preventDefault();

});

});

</script>

</body> </html>

Change History (3)

comment:1 Changed 7 years ago by gu_ludo

I think that is not a bug. You've called Event.preventDefault() method, so it was expected to the link not working anymore.

comment:2 Changed 7 years ago by gu_ludo

I want to apologize, now I got what you mean. But, anyways, I think this subject isn't supposed to be discussed here.. :)

comment:3 Changed 7 years ago by mikesherov

Resolution: notabug
Status: newclosed

Thanks for contributing a bug report. All of the docs.jquery.com tutorials should be considered out of date. If you have a bug in api.jquery.com to report, please go here: http://github/com/jquery/api.jquery.com/issues

Note: See TracTickets for help on using tickets.