Javascript for forcing lowercase text entry in a matrix table | XM Community
Skip to main content
Solved

Javascript for forcing lowercase text entry in a matrix table

  • May 4, 2021
  • 7 replies
  • 56 views

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

Best answer by ahmedA

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

7 replies

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


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • June 14, 2021

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



Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • June 15, 2021

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?


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • June 15, 2021

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. (: