refactoring - When using jQuery .each(), is it possible to use a non-anonymous function? -
i have code block find particularly long , hard udnerstood : call stack full of implicit functions , paramters implicitely added it. in other words, clarify code separating function called in each each itself.
look example :
$(xml).find('group').each(function () { var groupname = $(this).attr('name'); // there here around 100 lines of codes split in // @ least 5 functions, , i'm sure possible use named functions // instead of implicit ones, no ?
try passing function reference
$(xml).find('group').each(myfun); function myfun(i, item) { alert(item.id); }
Comments
Post a Comment