Javascript 如何从页面上的button元素中删除disabled?
我正在使用此代码设置和删除网页上按钮的禁用属性:Javascript 如何从页面上的button元素中删除disabled?,javascript,Javascript,我正在使用此代码设置和删除网页上按钮的禁用属性: if (localStorage.buttonColor) { document.getElementsByTagName('html')[0].className = localStorage.buttonColor; var themeButtons = document.querySelectorAll(".theme"); for (var button in themeButtons) { the
if (localStorage.buttonColor) {
document.getElementsByTagName('html')[0].className = localStorage.buttonColor;
var themeButtons = document.querySelectorAll(".theme");
for (var button in themeButtons) {
themeButtons[button].removeAttribute("disabled");
}
document.querySelector('button[name="' + localStorage.buttonColor + '"]').disabled = true;
}
但它给了我一个信息说:
Uncaught TypeError: Object 0 has no method 'removeAttribute'
有人能给我一些建议吗?将
禁用
视为属性,而不是属性:
themeButtons[button].disabled = false;
将禁用的
视为属性,而不是属性:
themeButtons[button].disabled = false;
将禁用的视为属性,而不是属性:
themeButtons[button].disabled = false;
将禁用的视为属性,而不是属性:
themeButtons[button].disabled = false;