How to remove the cursor from a text field?

Here is my code:

<table> <tr> <td><input type="text" value="test1" readonly /></td> </tr> <tr> <td><input type="text" value="test2" readonly /></td> </tr> <tr> <td><input type="text" value="test3" readonly /></td> </tr> </table> 

How to remove the cursor from a text field?

+4
source share
3 answers

Bad solution: pass the value in a hidden form element ( <input type="hidden"> ) and display it in a regular HTML container ( <p></p> , <div></div> or something else).

+1
source

If the browser shows the insertion cursor when the readonly attribute is set for the input[type="text"] element, you can use the caret-color CSS property to make the cursor transparent :

 .caret-hidden { caret-color: transparent; } 
 <input class="caret-hidden" type="text" readonly> 
0
source

You mean this:

 <input type="text" name="site" value="Stackoverflow" readonly="readonly" /> 

Demo: http://jsfiddle.net/UuZnh/

-1
source

All Articles