I have a simple function that goes through the page and adds a CSS class to every element that matches using .each() . I am also constantly updating the page with AJAX, and after the first AJAX update that changes things, the function is no longer applied.
code:
$("div.col-conversation span.label-sticky").each(function () { $(this).closest('li').addClass('stickyhighlight'); });
I understand why it does not work after the first AJAX event and tried to use .live() or .delegate() , but it does not seem like you can bind things that are not events (i.e. you can only bind to a click, freezing, etc.) using this method, so .each() will not work.
Is there an easy way to execute this function without including it in the callback with AJAX success and without using a plugin like livequery, which is likely to be redundant?
source share