I use ladda.js in different parts of my page as following:
var siteVisitConfirmation = $('.btn-site-visit-confirmation').ladda();
siteVisitConfirmation.click(function(position) {
siteVisitConfirmation.ladda("start");
setSiteVisitLocation(position);
});
I have 5 ladda buttons like this. Is there any way to find out which laddaButtons
are spinning?
If you need to check if a single button is spinnig, you can use the native function of the library called isLoading()
:
let laddaButton = $('#mybutton').ladda();
laddaButton.ladda('start');
laddaButton.isLoading(); //true
But if you need to get multiple, then you could simple check if the button has the data-loading
attribute:
let allButtonsSpinning = $('.btn-site-visit-confirmation[data-loading]');
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.