I am using the following style attribute to set the user input to uppercase so that when the user starts typing in the text box for example railway , then it should be altered to capital letters like RAILWAY without the user having to press the Caps-lock button.

This is the code i'm using to input

<input type = "text" class = "normal" name = "Name" size = "20" maxlength = "20"> <img src="../images/tickmark.gif" border="0" style='text-transform:uppercase'/>

But using this attribute i'm not getting the desired output

Best Answer


You've put the style attribute on the <img> tag, instead of the <input> .

It is also not a good idea to have the spaces between the attribute name and the value...

<input type="text" class="normal"
       name="Name" size="20" maxlength="20"
       style="text-transform:uppercase" />
<img src="../images/tickmark.gif" border="0" />

Please note this transformation is purely visual, and does not change the text that is sent in POST.