#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2016
    Location
    Lakewood, WA
    Posts
    207
    Rep Power
    17

    Disabling and Input


    Is it possible - maybe with CSS? - to disable an input without greying it out? I want to programatically populate the value, but restrict editing / changing the value.
  2. #2
  3. ~ bald headed old fart ~
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2005
    Location
    chertsey, a small town s.w. of london, england
    Posts
    356
    Rep Power
    132
    Hi there Arty Zifferelli,

    try it like this...

    Code:
    
    <!DOCTYPE html>
    <html lang="en">
    <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,height=device-height,initial-scale=1">
    
    <title>untitled document</title>
    
    <!--<link rel="stylesheet" href="screen.css" media="screen">-->
    
    <style media="screen">
    input[disabled="disabled"] {
        padding: 2px;
        border: 1px solid #aaa;
        background-color: #fff;
     }
    </style>
    
    </head>
    <body> 
    
     <input type="text" disabled="disabled">
     <input type="text">
    
    </body>
    </html>

    coothead
    ~ the original bald headed old fart ~
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Location
    Ahmedabad
    Posts
    17
    Rep Power
    0
    Hi,

    You can use the below code in html to disable Text..
    Code:
    <fieldset disabled>Name:<input type="text" /></fieldset>
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Location
    Ahmedabad
    Posts
    17
    Rep Power
    0
    Hi

    you can use another way to disable an input without greying it out
    Code:
    Name:<input type="text" readonly/>

IMN logo majestic logo threadwatch logo seochat tools logo