获取属性值的问题
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Document</title>
</head>
<body>
<input type="checkbox" name="haha" title="check box" description="just a checkbox" checked="true" id="check" disabled="me" />
<script type="text/javascript" src="jquery-1.8.3.js"></script>
<script type="text/javascript">
var checkbox = document.getElementById('check');
console.log(checkbox.description);
console.log(checkbox.getAttribute('description'));
console.log(checkbox.disabled);
console.log(checkbox.getAttribute('disabled'));
</script>
</body>
</html>老师,为什么disabled的获得的属性是true,而description的属性值是undefined?
26
收起
正在回答 回答被采纳积分+1
1回答
前端小白入门系列课程
- 参与学习 人
- 提交作业 11218 份
- 解答问题 36712 个
从一个不会编程的小白到一个老司机是需要过程的,首先得入门,学习基础知识,然后才能进阶,最后再到精通,本专题是你走进前端世界的不二选择!
了解课程
恭喜解决一个难题,获得1积分~
来为老师/同学的回答评分吧
0 星