Checkbox does not work on a page table


I have a CheckBox that does not work when I click on the other pages of my table, it does not send me the parameters.

In my code I call the function in this way.

asked by Ronald Rios 18.04.2016 в 19:02

1 answer



I think the solution of calling the function as many times as you change pages is not a good solution, you can even accumulate the triggers and get several calls to the same function and go creating a stack, we are a possible disaster.

One solution for this is to use 'bubbling events' (I'm not sure if it was called that). In a quick summary, is to attach this event to the document directly and search through the selector your element, no matter if you do not have these elements even in your html and you inject / generate later, launch the event as well.

This is the code:

$(document).on('change', '.clase-selector', function(){
    // Tu funcion aqui
answered by 20.04.2016 в 13:28