表单元素操作,button

禁用按钮

 

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
<button id="btn">Click Me</button>
<script>
    var obtn = document.getElementById('btn');

    obtn.onclick = function () {
//        this.disabled = true;
//        this.setAttribute('disabled', 'true');
    }

</script>
</body>
</html>

 

你可能感兴趣的:(表单元素操作,button)