javascript - The best way to bind event on a cell element -


i've webpage fullfilled js script creates lot of html tables.

number of <table> created can vary between 1 , 1000 100 cells in each of it.

my question : how bind efficiently click on theses tables? should bind click on each cell of <table> or directly <table> , retrieve cell clicked in bind function?

or have idea?

thanks

p.s: i'm using ie6+

i suggest use delegate.

$("table").delegate("td", "click", function(){     alert($(this).text()); // alert td's text. }); 

delegate bind 1 event, , context(in example, <table>).


Comments

Popular posts from this blog

drupal - using views argument in the view tpl.php file -

php - Posting PHPBB Forum Thread/Post info in a website -

php - Add a blog by sending a mail to a certain emailadress -