<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script src="../js/jquery-1.11.3.js" type="text/javascript"></script>
<script type="text/javascript" >
$(document).ready(function() {
var $d1 = $("#btn2"); //id
alert($d1.length);
});
</script>
</head>
<body>
<input type="button" value="选择 id为 one 的元素." id="btn2" />
<input type="button" value="选择 id为 one 的元素." id="btn2" />
</body>
</html>
alert($d1.length);的输出为什么是1呢?不是应该是2吗? |
|