freeze input text css

Solutions on MaxInterview for freeze input text css by the best coders in the world

showing results for - "freeze input text css"
Kaine
12 Jul 2016
1pointer-events: none; 
2
Hadrien
05 Jul 2017
1/*
2You can't disable anything with CSS, that's a functional-issue. 
3CSS is meant for design-issues. You could give the impression of 
4a textbox being disabled, by setting washed-out colors on it.
5
6To actually disable the element, you should use the disabled boolean 
7attribute: http://jsfiddle.net/p6rja/
8*/
9 <input type="text" name="lname" disabled />
10 /*Or, if you like, you can set this via JavaScript: 
11  http://jsfiddle.net/655Su/ */
12  document.forms['formName']['inputName'].disabled = true;
13/*exp */
14<form name="fish">
15    <input type="text" name="big" value="Big Fish" >
16    <input type="text" name="little" value="Little Fish" >
17    <input type="text" name="tiny" value="Tiny Fish" >
18</form>
19<script>
20      document.forms['fish']['big'].disabled = true;
21</script>
22/*
23Keep in mind that disabled inputs won't pass their values through 
24when you post data back to the server. If you want to hold the data,
25but disallow to directly edit it, you may be interested in setting
26it to readonly instead. Demo: http://jsfiddle.net/655Su/1/
27 */
28/* Similar to <input value="Read-only" readonly>*/
29document.forms['formName']['inputName'].readOnly = true;
30/*
31This doesn't change the UI of the element, 
32so you would need to do that yourself:
33*/
34input[readonly] { 
35    background: #CCC; 
36    color: #333; 
37    border: 1px solid #666 
38}
39/* You could also target any disabled element: */
40input[disabled] { 
41  /* styles */ 
42	pointer-events: none; 
43}
44
45/* https://stackoverflow.com/questions/2458595/disable-a-textbox-using-css */