Bug Tracker

Modify

Ticket #10555 (closed bug: duplicate)

Opened 20 months ago

Last modified 20 months ago

.live() + .trigger("change") throws a run time error

Reported by: prashantjain68 Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.6.4
Keywords: Cc:
Blocking: Blocked by:

Description

I have an element which is not added to the DOM. An event handler has been attached via .live(). The element dispatches a change event via trigger() and I get the following error ...

<DocumentFragment> has no method getAttribute.

Sample source code ... <html>

<head>

<script type="text/javascript" src="jquery.js"></script> <script>

$(document).ready(function() {

jQuery("[groupId='hobbies']").live("change", myHandler); var $checkbox = $("<input type='checkbox' groupId='hobbies'/>"); $checkbox.trigger("change");

});

function myHandler() { }

</script>

</head>

<body> </body>

</html>

NOTE: I do not get an error If this checkbox was appended to the DOM.

Change History

comment:1 Changed 20 months ago by prashantjain68

Seems like this got submitted twice. This is a duplicate of 10556.

comment:2 Changed 20 months ago by dmethvin

  • Status changed from new to closed
  • Resolution set to duplicate

comment:3 Changed 20 months ago by dmethvin

Duplicate of #10556.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.