Capitalise strings | XM Community
Solved

Capitalise strings

  • 11 March 2019
  • 2 replies
  • 6 views

Badge +1
I have a field for entering a name. Is there javascript (or other means) of capitalising the first letters of the name?
icon

Best answer by Anonymous 11 March 2019, 19:55

View original

2 replies

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()));

});
Badge +1
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.

Leave a Reply