Skip to content Skip to sidebar Skip to footer

Self-calling Function Inside Jquery Plugin

I am generating a tree (nested UL list) with javascript using the self-calling function below. I might add that it is within a jQuery plugin, if that is at all relevant to the issu

Solution 1:

You have a global variable. Do not treat var is as optional.

for (i = 0; i < gd.length; ++i) {  <-- i isglobal

now the other function call will not change it when you place var in front of i.

for (var i = 0; i < gd.length; ++i) {

Post a Comment for "Self-calling Function Inside Jquery Plugin"