JS to work on the same question on which it is written | XM Community
Skip to main content
I am wondering that how i can setup js on a question so that it should work on the same question on which it is written.

I tried on Unload function, but it is not working.



I have created a single punch grid as a non-mandatory grid, but I want that if anyone click on it without answering even a single response, he/she should see message "Please provide answer".
try adding below code on "onReady" function.



jQuery("#NextButton").click(function(){



if(jQuery(".q-checked").length == 0)

{

alert("Please provide answer")

}

});
@Mohammedali_Rajapakar_Ugam - That won't stop the page from advancing after the alert.



@salimlko - Assuming your addOnUnload code was correct, change addOnUnload to addOnPageSubmit.
@TomG ... Good catch.

However, I asked @salimlko to try it, if it doesn't work then we can look into it in more detail...

Leave a Reply