Convert to uppercase as user types using javascript

后端 未结 12 1579
清酒与你
清酒与你 2020-12-13 17:59

I want to convert lowercase chars to uppercase as the user types using javascript. Any suggestions are welcome.

I have tried the following:

$(\"#text         


        
12条回答
  •  鱼传尺愫
    2020-12-13 18:44

    This might be a nice workaround. Just set this in your CSS:

    input#textbox {
        text-transform: uppercase;
    }
    

    If you post the data to a server side script (lets say php) you can always do something like this:

    $upper_data = strtoupper($_POST['textbox']);
    

提交回复
热议问题