when the user starts typing the text in to the text box we need to make those letters to capital letters
Instead of a jQuery solution, I'd be tempted to use CSS to make the text inside the input to appear to be capitals (text-transform: uppercase
), regardless of whether or not they were inputted as lower or upper case. Then when you process your data, convert the data to upper case. For example in PHP, you'd use strtoupper()
- there are equivalent functions in most other languages I imagine you might be processing the form with!
EDIT: See chigley's answer instead.
$(function() {
$('#myTextBox').keyup(function() {
$(this).val($(this).val().toUpperCase());
});
});
Demo: http://jsfiddle.net/SMrMQ/
Alternately, style with CSS and do actual conversion on your back-end.
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