Text Entry Box Next to Question | XM Community
Skip to main content
Question

Text Entry Box Next to Question


Forum|alt.badge.img+2
  • Level 1 ●
  • 3 replies

Is there a way to move the text entry next to a question?

 

8 replies

MeganZich
Level 5 ●●●●●
Forum|alt.badge.img+36
  • Level 5 ●●●●●
  • 85 replies
  • April 25, 2023

I did not come up with this, but @MohammedAli_Rajapkar --it looks like you answered a similar question in the past:

 

Add below code in JavaScript (OnReady Function)

var QID = this.questionId;
var QIDOtherLabel = jQuery("#" + QID).find(".TextEntryBox").siblings().attr("id");
jQuery("[id='" +QIDOtherLabel+"']").append(jQuery("#" + QID).find(".TextEntryBox"));
jQuery("[id='" +QIDOtherLabel+"']").css("padding-top","30px");
jQuery("[id='" +QIDOtherLabel+"']").css("padding-bottom","30px");
jQuery("#" + QID).find(".TextEntryBox").css("float","none");


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 3 replies
  • April 25, 2023

That’s the code I used for the response categories on a multiple choice question for “other, please specify.” It does not work for a text-entry question!


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • April 26, 2023

Alternatively, we can also use form field question type and hide the question text using below JS:

jQuery(“#”+this.questionId+” .QuestionText”).hide();

 


Forum|alt.badge.img+2
  • Author
  • Level 1 ●
  • 3 replies
  • April 26, 2023

I’m getting the following error: 

 

Invalid JavaScript! You cannot save until you fix all errors: Unexpected token ILLEGAL


MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Level 5 ●●●●●
  • 137 replies
  • April 26, 2023
erd35 wrote:

I’m getting the following error: 

 

Invalid JavaScript! You cannot save until you fix all errors: Unexpected token ILLEGAL

Are you able to show what you’ve got in the JavaScript box?


Shashi
Level 8 ●●●●●●●●
Forum|alt.badge.img+32
  • Level 8 ●●●●●●●●
  • 633 replies
  • April 26, 2023
erd35 wrote:

I’m getting the following error: 

 

Invalid JavaScript! You cannot save until you fix all errors: Unexpected token ILLEGAL

jQuery("#"+this.questionId+" .QuestionText").hide();

Use above JS.


MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Level 5 ●●●●●
  • 137 replies
  • April 26, 2023

Did you put the JS in one of the sections? e.g. 

Qualtrics.SurveyEngine.addOnload(function()
{
jQuery("#"+this.questionId+" .QuestionText").hide();

});

 


Forum|alt.badge.img+5
  • QPN Level 2 ●●
  • 10 replies
  • April 26, 2023

Try this. Might not work, but give it a shot:

 

Qualtrics.SurveyEngine.addOnReady(function()
{
    /*Place your JavaScript here to run when the page is fully displayed*/
        jQuery("input[type=text]").attr('style','max-width: 60px !important');
        (jQuery(".QuestionText")).append(jQuery("input[type=text]"));
});