/*
You can't disable anything with CSS, that's a functional-issue.
CSS is meant for design-issues. You could give the impression of
a textbox being disabled, by setting washed-out colors on it.
To actually disable the element, you should use the disabled boolean
attribute: http://jsfiddle.net/p6rja/
*/
<input type="text" name="lname" disabled />
/*Or, if you like, you can set this via JavaScript:
http://jsfiddle.net/655Su/ */
document.forms['formName']['inputName'].disabled = true;
/*exp */
<form name="fish">
<input type="text" name="big" value="Big Fish" >
<input type="text" name="little" value="Little Fish" >
<input type="text" name="tiny" value="Tiny Fish" >
</form>
<script>
document.forms['fish']['big'].disabled = true;
</script>
/*
Keep in mind that disabled inputs won't pass their values through
when you post data back to the server. If you want to hold the data,
but disallow to directly edit it, you may be interested in setting
it to readonly instead. Demo: http://jsfiddle.net/655Su/1/
*/
/* Similar to <input value="Read-only" readonly>*/
document.forms['formName']['inputName'].readOnly = true;
/*
This doesn't change the UI of the element,
so you would need to do that yourself:
*/
input[readonly] {
background: #CCC;
color: #333;
border: 1px solid #666
}
/* You could also target any disabled element: */
input[disabled] {
/* styles */
pointer-events: none;
}
/* https://stackoverflow.com/questions/2458595/disable-a-textbox-using-css */
pointer-events: none;
Code Example |
---|
Css :: css floats |
Css :: online animation maker css |
Css :: repeat css |
Css :: text align in materialize css |
Css :: background image animation css codepen |
Css :: style class css |
Css :: outline offset css |
Css :: css chat |
Css :: pixel css |
Css :: transparent blur effect css |
Css :: padding |
Css :: add pseudo buttons |
Css :: include sass in html |
Css :: scss npm |
Css :: symfony app css not working |
Css :: WordPress Permalink for bread crumbs |
Css :: select tag text align center |
Css :: top 10 customers odoo |
Css :: how to add carasoule in html using css |
Css :: /* */ |
Css :: change button color ultimate member plugin |
Css :: total income of labrada company in india |
Css :: css selector data-entity-type |
Css :: curfont |
Css :: revert workflow version servicenow |
Css :: Fluid typography for Safari |
Css :: como dibujar un cuadro en css |
Css :: faire des colonnesdef etexte css |
Css :: remove a styles css class with javafx |
Css :: Remove Title spacing |