A Validation Error resfreshes the page and JavaScript won't execute. Why?

MickaelJRP Community Member Qubie ✭
edited July 2019 in Custom Code

I use this code in JavaScript to hide the PreviousButton on a page:

Qualtrics.SurveyEngine.addOnload(function() {
jQuery("input#PreviousButton.PreviousButton.Button").css("display", "none");

I use this code on the first question of the block, no page break, and put it in addOnload, addOnready, addOnunload.

However, one of the question has a validation parameter. When this validation is not met and the NextButton is pressed, the page reloads and the PreviousButton is back.

Why is that so and how to fix it?

Best Answer