Okay so, I have a textbox, it currently acts like a normal textbox, all I want for it to be able to is just display text, I don't want it to be able to be modified, is there a way to stop text from being put into it with HTML/JS? If I use the disable attribute it just goes all funny and I just hate the way it goes.. All I want is a normal textbox that acts like a normal textbox but just you cant edit the text inside.. I hope this is possible, thanks
How do I disable text input in a textbox without using the disable attribute? |
|
I just googled, and you can use READONLY instead of disable to achieve what you want
http://www.htmlcodetutorial.com/forms/_I...ABLED.html
Oct 22, 2013 06:54 AM
(This post was last modified: Oct 22, 2013 06:55 AM by Sir Paul McCartney.)
(Oct 22, 2013 06:49 AM)vitalitasia Wrote: I just googled, and you can use READONLY instead of disable to achieve what you want Hmm, in the example it works fine, but when I use it on my site I'm working on.. It acts similar to the disabled, but I am using bootstrap, I'll take a poke around, it is much better though, thanks! EDIT: Fixed the problem with bootstrap, it was simply removing .form-control[readonly] from Quote:.form-control[disabled], Thanks!
Oct 22, 2013 07:43 AM
(This post was last modified: Oct 22, 2013 07:49 AM by Sir Paul McCartney.)
(Oct 22, 2013 07:13 AM)GERmatti Wrote: "readonly" and "disable" won't stop users from being able to edit the value of the input. Never ever trust any input and check the value with PHP. You clearly don't get what I'm using it for.. the value in the textbox isn't being used for anything, it's purely for display, the input isn't being sent, processed, or output anywhere else.. I only want it purely for cosmetics.. I clearly state this in the OP: "all I want for it to be able to is just display text" (Oct 22, 2013 07:13 AM)GERmatti Wrote: "readonly" and "disable" won't stop users from being able to edit the value of the input. Never ever trust any input and check the value with PHP. Read first the OP's post before commenting like this one.With all due respect but your post is nonsense on what OP is asking for.
Is the textbox part of a form (despite it not being used/processed)? The reason I ask is because if you're just using it standalone, then it would be a much better idea to simply just use a regular div and just style it with CSS as if it were a textbox. This is more semantic.
|
|
|



![[Image: 2QzRqrh.png]](https://i.imgur.com/2QzRqrh.png)