I'm new to JavaScript and I have an HTML page with JavaScript where I need to show the text in a field with text "test text tuu" to upper case. I have tried to change it so:
this.harmonicField = new cjs.Text("test text tuu", "24px 'Fort Medium'", "#FFFFFF").toUpperCase();
and also like this:
this.harmonicField = this.harmonicField.toUpperCase();
but none of the commands work. When use these commands I don't see there anything - no text. Without the command toUpperCase()it works.
I have post it on pastebin.com (JavaScript and HTML):
How do I change the input text to upper case?
I'll try to answer clearly.
toUpperCaseis only applied to theStringit cannot be applied directly to anObjectas you trying to do.try something like this (i'm assuming you're using createJs library):
So you don't apply
toUpperCaseto the object but to a string.Also using
thisis always confusing but i think this could work:this.harmonicField.text = String(this.harmonicField.text).toUpperCase();In your case this old question from 2013 offers many good pointers in my opnion!