How do I add a custom class to a HTML input? | XM Community
Skip to main content
Solved

How do I add a custom class to a HTML input?

  • February 6, 2019
  • 1 reply
  • 72 views

KOgles
Level 3 ●●●
Forum|alt.badge.img+21
  • Level 3 ●●●
  • 51 replies
Looking to create a unique identifier on a HTML input to be able to hook up a multi select js function.

Best answer by TomG

The selector for the input will vary based on the type of question. For this example, I'm assuming a text input:
```
jQuery("#"+this.questionId+" input[type=text]").addClass("customClassname");
```
View original

1 reply

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5911 replies
  • Answer
  • February 6, 2019
The selector for the input will vary based on the type of question. For this example, I'm assuming a text input:
```
jQuery("#"+this.questionId+" input[type=text]").addClass("customClassname");
```

Leave a Reply