when the user starts typing the text in to the text box we need to make those letters to capital letters
views:
43answers:
3
+1
A:
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.
Ender
2010-10-06 16:48:54
+2
A:
$(function() {
$('input[type=text]').bind('keyup', function() {
var val = $(this).val().toUpperCase()
$(this).val(val);
});
});
Test it here :http://jsbin.com/opobu3
Ninja Dude
2010-10-06 16:51:34
+4
A:
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!
chigley
2010-10-06 16:51:42
Agreed. Don't use jQuery for this. It's a waste since everything should be capitalized vs just a few characters.
ryanulit
2010-10-06 16:54:35
On second thought, I agree with this.
Ender
2010-10-06 17:01:46