I don't know why this is happening, I am looping through a number ( Object.size(pagination) ), and setting an onclick event for each number. Upon clicking one of the buttons, it echos the last available page number, instead of the one I clicked.
for (var i = 1; i < (Object.size(window.pagination) + 1); i++) {
$("#supportTicket_pageNumber").append("<li class=\"\"><a style=\"cursor: pointer;\" class=\"supportTicket_pageNumber_" + i + "\">" + i + "</a></li>");
$(".supportTicket_pageNumber_" + i + "").click(function() {
console.log("Page number: " + i);
});
}
The classes with the numbers also get inserted fine, https://gyazo.com/92c556117bbd42bb7a16e7832b60af39