Previous and Next button status/class change
Previous and Next button status/class change

Hello,
is it possible to detect a change of class (or status) from enabled to disabled, and vice-versa for previous and next pagination buttons? I can see that class 'disabled' is added when disabled, and tabindex changes from 0 to -1, but how to detect the change? Thank you.
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
I don't think you can detect a change of class, but you could trigger on
draw
, that would be the only time those classes are modified.Colin
Thank you. I can scan a change with MutationObserver, but hoped for some 'cleaner' solution.
var target = $( "#example_paginate" )[0];
var observer = new MutationObserver(function(mutations) {
if($("#example_next").attr('tabindex')==-1)
// do something if next disabled
if($("#example_previous").attr('tabindex')==-1)
// do something if previous disabled
});
var config = { attributes: true, childList: true, characterData: true };
observer.observe(target, config);