Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

How do I disable text input in a textbox without using the disable attribute?

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
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:49 AM)vitalitasia Wrote:  I just googled, and you can use READONLY instead of disable to achieve what you want
http://www.htmlcodetutorial.com/forms/_I...ABLED.html

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],
.form-control[readonly],
fieldset[disabled] .form-control {
cursor: not-allowed;
background-color: #ee;
}


Thanks!
"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.
(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.


Possibly Related Threads...
Thread / Author Replies Views Last Post
by FrankeyNov 7, 2018 03:46 PM 5 157 Nov 7, 2018 03:46 PM
Last Post: Nachfolger
by klatzenMar 14, 2017 11:16 AM 5 260 Mar 14, 2017 11:16 AM
Last Post: klatzen
by Makaveli.Sep 7, 2016 05:58 AM 1 175 Sep 7, 2016 05:58 AM
Last Post: Sakuto