Answers for "disable input field html"

2

javascript disable input

//javascript disable
document.getElementById("id").disabled = true;
//javascript enable
document.getElementById("id").disabled = false;

//jquery disable
$('#id').attr("disabled", true);
//enable
$('#id').attr("disabled", false);
Posted by: Guest on May-25-2020
2

disable input type button in html

<input type="button" disabled value="Submit">
Posted by: Guest on November-26-2020
0

freeze input text css

/*
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 */
Posted by: Guest on December-06-2020

Code answers related to "disable input field html"

Code answers related to "Javascript"

Browse Popular Code Answers by Language