Text entry box like a tweet | XM Community
Skip to main content
Solved

Text entry box like a tweet

  • September 26, 2018
  • 4 replies
  • 23 views

Forum|alt.badge.img+2
Hi, I would like to have participants complete a tweet that ends by #... Ideally I would like to have the same box as on Twitter when you enter a post, with just a #... static at the end of the post Alternatively I would like to have just a box with #... at the end Any ideas ?

Best answer by Anonymous

Hello @Clin , Paste the following code in the js(onReady) of Text entry question jQuery("[id='QR~"+this.questionId+"']").val("#xxx"); jQuery("[id='QR~"+this.questionId+"']").keyup(function(){ var k=jQuery(this).val().replace(/#xxx/g, ""); jQuery(this).val(k+"#xxx"); });

4 replies

  • September 26, 2018
Hello @Clin , Paste the following code in the js(onReady) of Text entry question jQuery("[id='QR~"+this.questionId+"']").keyup(function(){ var k=jQuery(this).val().replace(/#/g, ""); jQuery(this).val(k+"#"); }); The above code will append '#' at the end of user input

Forum|alt.badge.img+2
  • Author
  • September 27, 2018
Hi @Shashi Thank you so much for your help. Is there a way I can have the #xxx appear at the end of a multiline text entry box, even before the participant starts typing? and it should stay while he/she is typing.

  • Answer
  • September 27, 2018
Hello @Clin , Paste the following code in the js(onReady) of Text entry question jQuery("[id='QR~"+this.questionId+"']").val("#xxx"); jQuery("[id='QR~"+this.questionId+"']").keyup(function(){ var k=jQuery(this).val().replace(/#xxx/g, ""); jQuery(this).val(k+"#xxx"); });

Forum|alt.badge.img+2
  • Author
  • September 28, 2018
Thanks!