Bug Tracker

Opened 10 years ago

Closed 10 years ago

#7483 closed bug (invalid)

triggle() in $(document).ready() can't work

Reported by: anonymous Owned by:
Priority: undecided Milestone: 1.5
Component: unfiled Version: 1.4.4
Keywords: Cc:
Blocked by: Blocking:


<!DOCTYPE html PUBLIC "-W3CDTD XHTML 1.0 TransitionalEN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <script type="text/javascript" src="jquery-1.4.4.min.js"></script> <script type="text/javascript">


$("#ok").trigger("click"); $("#ok").click(function(){




</script> <title>无标题文档</title> </head>


<input type="button" id="ok" value="ok" />

</body> </html>

in the code , this line $("#ok").trigger("click"); never execute.

Change History (2)

comment:1 Changed 10 years ago by jitter

This can't work. You call trigger() before you have bound the click handler. You need to revert the order if you want this to work.

See this test case

comment:2 Changed 10 years ago by ajpiano

Resolution: invalid
Status: newclosed

Closing as invalid.

Note: See TracTickets for help on using tickets.