Reputation: 797
Here an example my form http://jsfiddle.net/GT7fY/
How to convert all text to uppercase while user writing on the field?
Upvotes: 6
Views: 1034
Reputation: 623
Try this:
style input
input{text-transform:uppercase;}
and onBlur make uppercase
<input onBlur="$(this).val(this.value.toUpperCase());">
That's it :)
Upvotes: 4
Reputation: 852
$(":input").keyup(function() {
$(this).val($(this).val().toUpperCase());
});
all yours.
Upvotes: 2
Reputation: 2858
Paste This at the bottom:
$(document).ready(function(e){
$('input[type="text"]').on('keyup', function(){
$(this).val(this.value.toUpperCase());
});
});
Upvotes: 2
Reputation: 1157
$('form#verify').on('keyup', 'input', function(event) {
$(this).val($(this).val().toUpperCase());
});
Upvotes: 2
Reputation: 95017
I would just convert it to uppercase in the submit event.
$("#verify input").val(function(i,val){
return val.toUpperCase();
});
The uppercase requirement could simply be kept hidden from the user.
Upvotes: 3
Reputation: 76880
You could use keyup()
and toUpperCase()
$('input').keyup(function(){
this.value = this.value.toUpperCase();
});
fiddle here http://jsfiddle.net/GT7fY/2/
Upvotes: 5