Javascript.. problem with value by reference possibly
<p>The problem here is that page at alert has the final value of i.. any solution to this?</p>

<pre><code>  for(var i=start;i&lt;=end;i++)
            {
                num=pageNumber.clone();

                num.click(function(event)
                {
                    event.preventDefault();
                    var page=i;
                   alert(page);
                   // drawPager();
                });
                num.find("span").text(i);
                if(i==curPage) {
                    num.find("span").addClass("current");
                    num=num.find("span");


                }
                $("#pager&gt;div").append(num);
            }
</code></pre>
