Skip to main content

Bug Tracker

Side navigation

#8799 closed bug (invalid)

Opened April 07, 2011 10:50AM UTC

Closed April 07, 2011 11:00AM UTC

Last modified April 07, 2011 11:18AM UTC

document loading events ready through error!

Reported by: awakeel Owned by:
Priority: undecided Milestone: 1.next
Component: unfiled Version: 1.5.2
Keywords: Cc:
Blocked by: Blocking:
Description

document loading events

ready

like

$(

alert('test');

)

or

$.ready( alert('test');)

Through error, when i remove semi colon then its work fine. is it bug or user mistake. correct me if i am wrong?

Attachments (0)
Change History (4)

Changed April 07, 2011 11:00AM UTC by ajpiano comment:1

resolution: → invalid
status: newclosed

This is a user mistake. You have to pass a function reference to $(document).ready(), you are *executing* a window alert and passing its return value (nothing) to document ready as a handler. The correct syntax would be

$(function() {
 alert("test");
});

Changed April 07, 2011 11:14AM UTC by awakeel comment:2

_comment0: All three of the following syntaxes are equivalent: \ \ $(document).ready(handler) \ $().ready(handler) (this is not recommended) \ $(handler) \ \ \ The three format is supported so i am using the last one. did you checked that.1302174954899404

All three of the following syntaxes are equivalent:

$(document).ready(handler)
$().ready(handler) (this is not recommended)
$(handler)

The three format is supported so i am using the last one. did you checked that.

Changed April 07, 2011 11:17AM UTC by ajpiano comment:3

A function reference is not the same as executing a function. http://fixingthesejquery.com/#slide32

Changed April 07, 2011 11:18AM UTC by awakeel comment:4

Ok