I'm having problems with some dynamic elements that I'm creating with Jquery.
for(var i = 1; i <= totalPages; i++) {
var link = $(document.createElement('a')).html(i.toString());
link.attr("id", "link" + i);
link.click(function ()
{
nextPage(i);
});
link.css('cursor', 'pointer');
}
When I see the page and click in the links they always send the parameter with the last value of the variable "i" (always totalPages + 1).
Anyone knows what am I doing wrong?