var a = document.getElementById("ok")
a.getAttribute('disabled')返回的为什么是 "" ?
getAttribute() 返回元素上指定属性(attribute)的值。如果指定的属性不存在,则返回 null 或 "" (空字符串) 这个是MDN上的介绍.
a.hasAttribute('disabled') 返回的也是true
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
因为那个 disabled属性没有值啊 这个属性和readonly不用赋值就会生效 除非赋值false不会生效