hello, Im trying to figure out a better way to do this. it works but its very sluggish, so i think theyre might be a better way to iterate?
i have an input field = .searchbox and then i have a YUI datatable that contains about 65 rows. when i start to type in the search field, it iterates over all the tr's looks at 2 cell text values and then uses the indexOf method to determine whether or not to display the <tr> is there a way that i can iterate once and put those values into cache or something? here is my code. $(document).ready(function () { var searchbox = $('.member_search_input'); var member_row = $('#members_data_table_wrap table tbody tr'); searchbox.click(function() { $(this).val(''); }); searchbox.bind('change keyup', function() { member_row.each(function() { var number = $(this).find('.yui-dt1-col-PhoneNumber div a').text(); var name = $(this).find('.yui-dt1-col-Name div').text(); var search_check_value = (name + number); var search_value = searchbox.val(); if (search_check_value.indexOf(search_value) > -1) { $(this).show(); } else { $(this).hide(); } }); }); });