disabled button code example

Example 1: jquery add disabled to button

$("#button").attr("disabled", true);

Example 2: javascript disable button

//disable the button
document.getElementById(BUTTON_ID).disabled = true;
//reable the button
document.getElementById(BUTTON_ID).removeAttribute('disabled');

Example 3: style disabled button

button:disabled,
button[disabled]{
  border: 1px solid #999999;
  background-color: #cccccc;
  color: #666666;
}

Example 4: html button disabled

<button type="button" disabled>This button is disabled</button>

Example 5: javascript disable button

document.getElementById(BUTTON_ID).disabled = true;

Example 6: enable html button

$('#Button').prop('disabled', true);

Tags:

Misc Example