Gustavo Reyes Gustavo Reyes - 4 months ago 20
jQuery Question

How can I change all input values to uppercase using Jquery?

I want to change all my form values to uppercase before the form is submitted.

So far I have this but it's not working.

$('#id-submit').click(function () {
var allInputs = $(":input");
$(allInputs).value.toUpperCase();
alert(allInputs);
});

Answer

Try like below,

$('input[type=text]').val (function () {
    return this.value.toUpperCase();
})

You should use input[type=text] instead of :input or input as I believe your intention are to operate on textbox only.