Last active
September 9, 2018 17:27
-
-
Save theKAKAN/28b658acb64d41b18597bd71151a32b9 to your computer and use it in GitHub Desktop.
Wait for element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var waitForEl = function (selector, callback) { | |
jQuery.when(jQuery(selector)).then(callback); | |
} | |
// Example for adding an item to cart | |
// in Amazon | |
var element = '#add-to-cart-button'; | |
waitForEl(element, function (self) { | |
self.trigger('click'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment