Capitalise strings | XM Community
Skip to main content
Solved

Capitalise strings

  • March 11, 2019
  • 2 replies
  • 18 views

Forum|alt.badge.img+1
I have a field for entering a name. Is there javascript (or other means) of capitalising the first letters of the name?

Best answer by Anonymous

Hello @duncan_19 , Paste the below code to the js(onReady) of the Text entry question type jQuery("#"+this.questionId+" .InputText").on('blur',function(){ jQuery(this).val(jQuery(this).val().replace(jQuery(this).val()[0],jQuery(this).val()[0].toUpperCase())); });

2 replies

  • Answer
  • March 11, 2019
Hello @duncan_19 , Paste the below code to the js(onReady) of the Text entry question type jQuery("#"+this.questionId+" .InputText").on('blur',function(){ jQuery(this).val(jQuery(this).val().replace(jQuery(this).val()[0],jQuery(this).val()[0].toUpperCase())); });

Forum|alt.badge.img+1
  • Author
  • March 12, 2019
Thanks Sashi - this works for the first name but not the last name. Can you extend the code to capitalise all first letters - that would be perfect.