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);
});
Use toLocaleUpperCase() method to transform the input to uppercase and again set it to the input element.
The toUpperCase() method converts a string to uppercase letters. The toUpperCase() method does not change the original string.
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.
use css :
input.upper { text-transform: uppercase; }
probably best to use the style, and convert serverside. There's also a jQuery plugin to force uppercase: http://plugins.jquery.com/plugin-tags/uppercase
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With