I have implemented a menu with jQuery where the items and the functions are assigned dynamically. This code works.
But since I need to hide the menu when the option is clicked, I changed
p.click(funcs[i].f);
to
p.click(function(){
menu.hide();
funcs[i].f;
});
as in here,but I get Uncaught TypeError: Cannot read property 'f' of undefined
because the variable i is out of bounds. how to fix this code?