0
I have a div class="modal-load" with a counter uploader that will be shown when the user finalizes a payment, but I need that counter to start only when the class is added .active in it. For this, I created a function in the JS that runs this load. I believe that this function should be rotated only after receiving the informed class.
I tested as below:
$(document).ready(function() {
if ($(".modal-load").hasClass('ativo')) {
startLoader();
}
});
When I leave the class already inline and update the page works perfectly. However, when I leave to add the class by the console, nothing done!
But there you are testing if the
modal-load
have the class active, but, you haven’t added the active class yet.– LeAndrade
@Leandrade I need to say that when the class is added, it runs the function. How?
– Victoria Moura
Which event adds the class? In this same event you execute the function.
– Sam
@I guess I’ll just have to do that myself!
– Victoria Moura