Set interval using jquery - Magesan

Set interval using jquery

Set interval using jquery

Set interval is very important method, which is simultaneously checks for the element if the element is exists or not.

It is invoke to the time you provided in interval function, And it will continue to invoke till then the element is not found.

var interval = setInterval(() => {
    var elementClass = jQuery('.element-class');
    if (elementClass.hasClass('element-has-class')) {
         alert('class-found');
         clearInterval(interval);
    }
}, 50);

Leave a Reply

Your email address will not be published. Required fields are marked *.

*
*
You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>