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
Post a Comment