请问一个jquery的问题 我用$('.TreeView1_0');获取了所有class=‘TreeView1_0'的元素集合,请问用什么方法获取$('.TreeView1_0')的元素个数,还有第某个元素?? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 $('.TreeView1_0').length;$('.TreeView1_0')[0] $('.TreeView1_0').length;$('.TreeView1_0')[0]//这个是不可以的 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>无标题文档</title><style>.test{ width:200px; height:30px; border:1px solid blue;}</style><script src="jquery-1.3.2.js"></script><script>$(document).ready(function(){ alert($(".test").length); alert($(".test:eq(0)").text())//第一个});</script></head><body><div class="test" id="1">1</div><div class="test">2</div><div class="test">3</div><div class="test">4</div></body></html>这样是可以的$('.TreeView1_0:eq(0)')//这样是可以的 使用 WdatePicker 的时候有个地方怎么解决? 我希望选中一个日期框 选择以后 另一个日期框就默认为 模态窗口调用servlet返回后,javascript却不执行了? 大家帮我看看,为什么此请求只执行一次! 请教:有几个文本框,怎样在输入特定长度的字符后自动将焦点移到下一个文本框? 如何在两个窗口之间传递对象 判断时间大小 页面跳转问题 请问javascript中document.execCommand的使用方法及属性 IOS设备上视频如何自动播放 新手,请问我这题这样写不对吗? js在Firefox中报错 Cookie问题。有点灵异现象
$('.TreeView1_0')[0]
$('.TreeView1_0').length;
$('.TreeView1_0')[0]//这个是不可以的
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
.test{
width:200px;
height:30px;
border:1px solid blue;
}
</style>
<script src="jquery-1.3.2.js"></script>
<script>
$(document).ready(function(){
alert($(".test").length);
alert($(".test:eq(0)").text())//第一个
});
</script></head><body>
<div class="test" id="1">1</div>
<div class="test">2</div>
<div class="test">3</div>
<div class="test">4</div>
</body>
</html>
这样是可以的
$('.TreeView1_0:eq(0)')//这样是可以的