You should have a look at event delegation, currently you are attaching 2 event on each row. So if you have a lot of rows, its memory/cpu heavy.
On Tue, Dec 16, 2008 at 11:52 AM, stephen <barto...@gmail.com> wrote: > > Hi, > > I have a table of data made from divs, and the mouse roll-over > highlighting is done using jQuery. But now I have added "real" data, > the data table (about a thousand rows) is a lot bigger. The problem > is, jQuery becomes unresponsive and Firefox throws the error: > > A script on this page may be busy, or it may have stopped responding. > You can stop the script now, open the script in the debugger, or let > the script continue. > Script: /views/js/jquery.js:19 > > My code for the row highlighting is: > $(document).ready(function(){ > // Row highlighting > $(".row").mouseover(function() { > $(this).addClass("row_highlight"); > }); > > // Remove the highlight when the mouse leaves the row. > $(".row").mouseout(function() { > $(this).removeClass("row_highlight"); > }); > }); > > Am I doing something wrong? Is there a better way of doing this which > will not cause an error to be thrown? > > Thanks, > Stephen >