How to Stay the Same Page When Clicking the Embedded Link? | XM Community
Skip to main content

Hi Communities,
I have a question on the inserted link. I want to insert a hyperlink in a text question and it will direct to a new window. But I found that after I click the link, the page will be automatically forwarded to next page. This may leave little time for respondents to read the question texts.
So I wonder if someone can have any ideas that I can stay the same page even if I click the link?
Thank you so much in advance.

If you have a link and by clicking it, you are getting redirected to that page on the same screen, then you can add the target attribute, it will open the link in new window, if this what you are looking.
Click me


https://www.qualtrics.com/community/discussion/comment/28514#Comment_28514Hi SurajK,
Thank you so much for the help.
Indeed, I have set it as you recommended and it will open the link in a new window.
My question is that just when I click the link and open it in a new window, my survey question page will automatically forward to next page, which might leave respondents little time to go through the materials on this page. So I wonder if there is any solution to this problem.
Best,
Qingyan


The next button should not get clicked automatically when you click on the link. Are you using any other JS code to click the next button automatically after some time or when you click on the link. Because next page can't appear until you click next button or you have set any other custom code to do it.


Could you please more details.
I am able to stay in the same page when I clicked a link which opens in separate window which I viewed and closed/open and came back to survey link and able to answer and move ahead.


https://www.qualtrics.com/community/discussion/comment/28545#Comment_28545Hi SurajK,
Thank you so much for the help.
Yep. I think you mean the following JS code:
Qualtrics.SurveyEngine.addOnload(function() {
  jQuery('#clicked2').click(function(event) {
    Qualtrics.SurveyEngine.setEmbeddedData("clicked2", "1");
    jQuery("#NextButton").click();
  });
});.
Sorry, I might not be that familiar with JS code. I wonder if I delete "#NextButton", would it affect code's function? The JS code here is to record whether the link has been clicked or not.
Best,
Qingyan


https://www.qualtrics.com/community/discussion/comment/28574#Comment_28574Hi Appzk,
Thanks for your reply.
Like what we discussed above, the problem could be with the following JS code:
Qualtrics.SurveyEngine.addOnload(function() {
  jQuery('#clicked2').click(function(event) {
    Qualtrics.SurveyEngine.setEmbeddedData("clicked2", "1");
    jQuery("#NextButton").click();
  });
});.
Sorry, I might not be that familiar with JS code. I wonder if I delete "#NextButton", would it affect code's function? The JS code here is to record whether the link has been clicked or not.
Best,
Qingyan


https://www.qualtrics.com/community/discussion/comment/28642#Comment_28642Correct, because of this code the next button is getting clicked. Just comment out that line or remove it. Anyway you want to flag if the link is clicked or not and you are doing this by setting embedded data. I hope you have created the clicked2 embedded variable above this question.


https://www.qualtrics.com/community/discussion/comment/28646#Comment_28646Hi SurajK,
Thank you so much!
Yep. I got the clicked2 embedded variable before. Just wanna double check. I should change the JS code as follows, right?
Qualtrics.SurveyEngine.addOnload(function() {
  jQuery('#clicked2').click(function(event) {
    Qualtrics.SurveyEngine.setEmbeddedData("clicked2", "1");
  });
});.

Best,
Qingyan


https://www.qualtrics.com/community/discussion/comment/28665#Comment_28665This is correct. If this won't work try to add the code in addOnReady function.


https://www.qualtrics.com/community/discussion/comment/28680#Comment_28680Hi Surajk,
Sorry to reply you late.
Thank you so much. It worked as expected!!! That's awesome!
I should learn more on the JS Code later.


Leave a Reply