I have a paged list of items, each with a checkbox associated with it.
If I click a checkbox, I write that checkbox's id to a cookie. When the page reloads, i want to re-check all the previously selected checkboxes.
This works fine with the following code:
$('.fund-compare-check-box').each(function () {
var cookie = getCookie("fund_basket").split("|");
// re-check all check boxes
});
The problem I have with this, is when I load the next page of results. The code above only runs when the DOM is ready.
I thought I could fix this by using .live() instead of .each(), as follows:
$('.fund-compare-check-box').live('each', function () {
var cookie = getCookie("fund_basket").split("|");
// re-check all check boxes
});
but when I use this, nothing happens at all. Am I doing this wrong? Any pointers would be much appreciated!