Checking if error message is displayed or not | XM Community
Skip to main content
Hi all,

I have a delayed question appearing after a timeout. Participants need to answer it correctly, if not qualtrics validates with the inbuilt validation. The challenge: on failed validation, the page reloads, executing the onload jquery code again --> The delayed question is delayed again. Instead it should condition the delay to be executed only the first time the page loads: my approach: if the error msg is not shown, set delay = 0.



I tried checking the css property of the ValidationError like so

`if ( jQuery(".ValidationError").css("display") == "none" ) { ... }`

but this doesn't work.



How to check if the validation failed?

Thanks,

Jana
Try this:

```

if(jQuery("#"+this.questionId+" .ValidationError").is(":hidden")) { ... }

```
Hi Tom,

thank you for the quick response. Unfortunately that doesn't to the trick: Adding it within `addOnReady`, it fires even when the validation error is going to be displayed.



EDIT

Adding it also to `addOnload` it worked. Thank you!

Leave a Reply