Capitalise strings | Experience Community
Skip to main content
Solved

Capitalise strings

  • Mar 11, 2019 11:20 AM UTC
  • 2 replies
  • 28 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())); });
View original

2 replies

  • Answer
  • Mar 11, 2019 6:55 PM UTC
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
  • Mar 12, 2019 7:27 AM UTC
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.