I've been looking into ways to detect when the value of an attribute changes to equal a specific value. MutationObserver seems to indicate only that the attribute value has changed as opposed to checking to see that is has changed and is equal to a specific value.
I have click event that runs a setTimeout of 200ms to call a function for a radial progress indicator. The value of the HTML attribute for the indicator counts up from 0 to 100 after the click and setTimeout. When it's complete, the HTML is as follows:
<div class="radial-progress" data-progress="100">
Is there a way that I can fire another function or run some other code when and only when data-progress == 100?
Here is the script:
$("#someID").on("click", function(event){
event.preventDefault();
// Load-progress counter //
window.loadProgress = function() {
$('.loadProgress .radial-progress').attr('data-progress', Math.floor(1 * 100));
}
setTimeout(window.loadProgress, 200);
// Run some other code when data-progress == 100
});