IE 8 prompts user on "slow" jQuery script
- by Jason
I have a form with over 100 list items that I must reorder on submit. The following code works to reorder my list without any apparent problems in Firefox; however, IE prompts with the message "A script on this page is causing Internet Explorer to run slowly. If it continues to run, your computer may become unresponsive. Do you want to abort the script?" If the user clicks 'No', the script will work as expected.
var listitems = $(form).find('li').get();
listitems.sort(function(a, b) {
var compA = $(a).attr('id');
var compB = $(b).attr('id');
return (compA - compB);
});
Any ideas on how to make this more efficient?