Javascript uppercase not working

javascript, jquery

Solution

Change to this:

uni = uni.toUpperCase();

Strings are immutable, so you need to assign the result to the variable, overwriting the old string.

Problem

I am trying to change text input value after user fill it, to uppercase string: ``` $('#University').blur(function(){ if ( $(this).attr("value") != '') { var uni = $(this).val(); uni.toUpperCase(); alert(uni); $(this).attr("value", uni); }; }); <input type="text" name="Universidad" size="45" class="required" id="University"> ``` If I write "leandro" into the field, the `alert(uni)` throws: "leandro" and not "LEANDRO". Any idea? I could not use CSS because I must send uppercase data through this form, and css only change the rendering and not the value

Original source