Text entry box like a tweet | XM Community
Solved

Text entry box like a tweet

  • 26 September 2018
  • 4 replies
  • 8 views

Userlevel 1
Badge +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 ?
icon

Best answer by Anonymous 27 September 2018, 19:08

View original

4 replies

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
Userlevel 1
Badge +2
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.
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");

});
Userlevel 1
Badge +2
Thanks!

Leave a Reply