I'm developing a few forms for my company to use. I consult and insert data into the database, but for standard issues I want to transform the text I enter to uppercase, How I do that?
Example of one of my forms:
I want the text fields I enter in automatically transformed to uppercase, or the data that I enter into my database already transformed to uppercase (in the case that the user doesn't enter it that way).
EDIT:
I try
$("tbCiudad").change(function() {
$(this).val($(this).val().toUpperCase());
});
or
$("tbCiudad").keyup(function() {
$(this).val($(this).val().toUpperCase());
});
and nothing happens to that field. What am I doing wrong?
$("input[type=text]").keyup(function(){
$(this).val( $(this).val().toUpperCase() );
});
You can add an event handler with javascript (or jquery if you want) to keypress
or blur
events of those textboxes and then apply what Jay Blanchard suggested. Something like this:
$("input[type='text']").bind("blur", null, function(e) {
$(this).val($(this).val().toUpperCase());
});
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