Javascript for forcing lowercase text entry in a matrix table | XM Community
Solved

Javascript for forcing lowercase text entry in a matrix table


Hi! I'd like advice on what is the javascript for forcing lowercase text entry in a specific column within a matrix table.
For example, in the screenshot attached, I need all the email addresses entered to be in lowercase (second column). The names (first column) have no case restriction.
The javascript I know for doing this on a text entry is this: "jQuery("#"+this.questionId+".InputText").on('input', function () {this.value = this.value.toLowerCase();});})", but I'm not sure how to adjust this code for a matrix table. So any help would be greatly appreciated! Thank you. (:
image.png

icon

Best answer by ahmedA 15 June 2021, 05:52

View original

7 replies

Checking back on my previous query. Anyone expert enough to venture an answer? Or is my question not clear enough?

Userlevel 7
Badge +21

Change ".InputText" to ".last .InputText"

https://www.qualtrics.com/community/discussion/comment/38335#Comment_38335Nope, this didn't work. Thanks anyway. (:

Userlevel 7
Badge +21

Okay. Matrices do not use the class InputText:
Try this: jQuery("#"+QID+" .last input")
make note of the spaces.

https://www.qualtrics.com/community/discussion/comment/38356#Comment_38356Oh great! This is working now! THANK YOU.
What happens though if the column is not the last column, but say the 3rd column in the centre? What code should I use?

Userlevel 7
Badge +21

Inspect the element. Find its class name (should be something like c4) and replace last with it.

Ok, I'll give that a try! Thank you so much, once again. (:

Leave a Reply