I have a HTML reference to an input value that I would like to set in uppercase. I’ve tried the code below, but I still get capslock sensitive input values…
const input_field = document.getElementById(’#input_field ’) ;
input.field.value.toUpperCase();
Marmiz
February 27, 2020, 9:58am
2
Mind the name: input_field
That said you probably want to assign the upper case value to the input value, so you need an assignment operation:
input_field.value = input_field.value.toUpperCase();
Hope this helps
Aah, I see! Thanks a lot!
Marmiz
February 27, 2020, 10:29am
4
To be fair, toUpperCase
is a function that returns a new string, it’s up to you to do what you want with that returned value