I have a binding to a search input like this:
$(document).on('tablebeforefilter.results_filter',
'#results_table:not(.bound)',
function (e, data) {
e.target.class += "bound";
// stuff
});
I'm using the bound
class to prevent re-binding of the element if the page is reloaded (I'm using Jquery Mobile
so this will happen when the user goes back and forth between two pages.
My problem is, doing it like this will correctly set the binding, but it will trigger my handler only once, presumable, because I add the 'bound' class to the element.
Question:
Why is it like this? I thought a binding set on $(document) & some element
would be set and then runs no matter what class I add to this element. Only when the page is re-parsed my bound
class prevents attaching the binding a second time. Why is my function no longer triggering if I add the blocking bound
class?
Thanks!