Bug Tracker

Modify

Ticket #6085 (closed bug: invalid)

Opened 3 years ago

Last modified 3 years ago

getting too much recursion

Reported by: gamesh Owned by:
Priority: Milestone: 1.4.1
Component: event Version: 1.4.1
Keywords: too much recursion error Cc:
Blocking: Blocked by:

Description

on table if click on row is assigned and then triggering click event on a child element i get error "too much recursion". Error is triggered by the click method called on the checkbox. too much recursion ? in jquery.min.js@58()jquery.min.js (line 58) ? in jquery.min.js@31()jquery.min.js (line 31) ? in jquery.min.js@53()jquery.min.js (line 53) ? in jquery.min.js@48()jquery.min.js (line 48) [Break on this error] ba;var a=this.originalEvent;if(a){a.st...nts)};c.each({mouseenter:"mouseover", jquery.min.js (line 58)

script: $('table tbody tr').click(function(){

$(':checkbox', this).click();

});

html example: <table>

<tbody>

<tr>

<td><input type="checkbox" ... /></td> <td></td> .....

</tr>

</tbody>

</tbody>

Change History

comment:1 Changed 3 years ago by john

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

That's because the event is bubbling up the tree, causing it to fire again. You should change your script to:

$('table tbody tr').click(function(e){
  if ( e.target === this ) {
    $(':checkbox', this).click();
  }
}); 

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.