simulate mouse click | XM Community
Skip to main content
Hi



I have coded that my text form item dynamically adjusts when I mouse-click into the last form field (adds a new text entry box for an additional entry). It works fine but because it uses questionclick only if you use your mouse and obviously not if you use the tab key to move from one text box entry to the next. I didnt find an API that adds a listener for a tab event. Is there any way to simulate entering the tab key as a mouse-click?



Thanks in advance!
You could use focus events on the input boxes instead of questionclick. A focus event would fire when a text field is clicked on or tabbed to.
Thanks! This isn't included in Qualtrics JS Question API though, right? How can I make use of the focus function, do I need an event listener first?
> @automaticadd said:

> Thanks! This isn't included in Qualtrics JS Question API though, right? How can I make use of the focus function, do I need an event listener first?



Focus is a JS event. You can use the jQuery focus() function to bind an event handler to the text input fields, something like:

```

jQuery("#"+this.questionId+" .InputText").focus(function() {

//your code goes here

});

```

Leave a Reply