Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to transform textfield data to uppercase while user is typing within the field?

Tags:

html

jquery

There is a textfield : <input type="text" id="id" name="name" value="value" />

How to make any entered data to be in uppercase while it is typing ?

like image 398
pheromix Avatar asked Nov 28 '22 08:11

pheromix


1 Answers

use keyup() and toUpperCase()..

$('#id').keyup(function(){
    $(this).val($(this).val().toUpperCase());
});

or using DOMelement

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

or using just CSS (no javascript at all)

 #id{
    text-transform:uppercase;
 }

using CSS fiddle

fiddle here

like image 136
bipen Avatar answered Dec 10 '22 21:12

bipen