Modify ↓
Ticket #8799 (closed bug: invalid)
document loading events ready through error!
| Reported by: | awakeel | Owned by: | |
|---|---|---|---|
| Priority: | undecided | Milestone: | 1.next |
| Component: | unfiled | Version: | 1.5.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
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?
Change History
comment:1 Changed 2 years ago by ajpiano
- Status changed from new to closed
- Resolution set to invalid
comment:2 Changed 2 years ago by awakeel
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.
comment:3 Changed 2 years ago by ajpiano
A function reference is not the same as executing a function. http://fixingthesejquery.com/#slide32
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

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"); });