How to do when the user enters text input and then automatically converts it to uppercase in jQuery?

Here is an example of my form http://jsfiddle.net/GT7fY/

How to convert all text to uppercase when a user writes to a field?

+6
source share
6 answers

You can use keyup() and toUpperCase()

 $('input').keyup(function(){ this.value = this.value.toUpperCase(); }); 

fiddle here http://jsfiddle.net/GT7fY/2/

+5
source

Try the following:

 style input input{text-transform:uppercase;}​ and onBlur make uppercase <input onBlur="$(this).val(this.value.toUpperCase());"> 

What is it:)

+4
source

I would just convert it to uppercase into a send event.

 $("#verify input").val(function(i,val){ return val.toUpperCase(); }); 

A capital requirement can simply be hidden from the user.

+3
source
 $('form#verify').on('keyup', 'input', function(event) { $(this).val($(this).val().toUpperCase()); }); 

+2
source

Paste This at the bottom:

 $(document).ready(function(e){ $('input[type="text"]').on('keyup', function(){ $(this).val(this.value.toUpperCase()); }); }); 
+2
source
 $(":input").keyup(function() { $(this).val($(this).val().toUpperCase()); }); 

all yours.

+2
source

Source: https://habr.com/ru/post/909101/


All Articles