Disable buttons using JS
Posted: Thu Feb 06, 2014 1:45 pm
I want to disable or enabled a couple of buttons when the user clicks a check box using JavaScript.
The default is disabled, and when I click they will become enabled, but when I click it again it should turn the checkbox off and disabled the buttons.
Here's my onclick code for the checkbox:
var checkbox = document.getElementById("Checkbox1");
if (checkbox.value = true)
{
applyProperty("ChangeBTN", "disabled", "0");
applyProperty("DeleteBTN", "disabled", "0");
}
else
{
applyProperty("ChangeBTN", "disabled", "1");
applyProperty("DeleteBTN", "disabled", "1");
}
applyProperty("ChangeBTN", "field type", "graphic button"); // force field to be rerendard
applyProperty("DeleteBTN", "field type", "graphic button"); // force field to be rerendard
The default is disabled, and when I click they will become enabled, but when I click it again it should turn the checkbox off and disabled the buttons.
Here's my onclick code for the checkbox:
var checkbox = document.getElementById("Checkbox1");
if (checkbox.value = true)
{
applyProperty("ChangeBTN", "disabled", "0");
applyProperty("DeleteBTN", "disabled", "0");
}
else
{
applyProperty("ChangeBTN", "disabled", "1");
applyProperty("DeleteBTN", "disabled", "1");
}
applyProperty("ChangeBTN", "field type", "graphic button"); // force field to be rerendard
applyProperty("DeleteBTN", "field type", "graphic button"); // force field to be rerendard