Skip to main content

Bug Tracker

Side navigation

#12842 closed bug (notabug)

Opened November 03, 2012 04:53PM UTC

Closed November 04, 2012 06:20PM UTC

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>

Attachments (0)
Change History (3)

Changed November 04, 2012 06:07PM UTC by gu_ludo comment:1

I think that is not a bug.

You've called Event.preventDefault() method, so it was expected to the link not working anymore.

Changed November 04, 2012 06:12PM UTC by gu_ludo comment:2

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

Changed November 04, 2012 06:20PM UTC by mikesherov comment:3

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