Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

SOLVED

How do I delay triggering a rule condition for an event based rule?

rajatkhare
Level 1
Level 1

Hey guys,

I created an event-based rule that is triggered when a user clicks on a link. I need to check if a certain class exists on an element to determine if the rule has to be triggered or not.

The class is added when a user clicks on a link.

The problem (I think) is that by the time the class is added, the rule condition is already checked and the rule is not triggered. Is there a way to delay the checking of the rule condition?

I tried the following but it's not working:

window.setTimeout(function() {

if(!$('.login-register').hasClass('closed')) {

return true;

  }

}, 1000); // Wait for one second to check if the class 'closed' has been added to the element.

Any help is greatly appreciated.

1 Accepted Solution
Stewart_Schilling
Correct answer by
Community Advisor
Community Advisor

You could create a data element based on $('.login-register').hasClass('closed')

Then you could create a data element changed rule that allows you to further inspect for the required value.

View solution in original post

1 Reply
Stewart_Schilling
Correct answer by
Community Advisor
Community Advisor

You could create a data element based on $('.login-register').hasClass('closed')

Then you could create a data element changed rule that allows you to further inspect for the required value.

View solution in original post