Skip to content Skip to sidebar Skip to footer

Function Inside For Loop (js/jquery)

I call a function inside a for loop, but the function doesn't seem to work properly $(document).ready(function(){ function fn_get_natural_dim(){ var width = this.width; var

Solution 1:

You're callingfn_get_natural_dim when you should just be passing a reference to it:

img.onload = fn_get_natural_dim;

There might be other problems too, but this one's the killer.

Post a Comment for "Function Inside For Loop (js/jquery)"