<div id="one">
<div id="two">hello</div>
<div id="three">word</div>
<div id="three">
<p><a href="#">tonsh</a></p>
</div>
</div>$("#three").parent()[0].css({'background-color' : 'red', 'font-weight' : 'bolder'});这样搞不行啊 求解
<div id="two">hello</div>
<div id="three">word</div>
<div id="three">
<p><a href="#">tonsh</a></p>
</div>
</div>$("#three").parent()[0].css({'background-color' : 'red', 'font-weight' : 'bolder'});这样搞不行啊 求解
解决方案 »
- 网页上的视频文件调用本地默认软件打开
- 模态窗口怎么自动刷新???
- 下面代码中substring 为啥是返回(lens-4,lens) 谁能告诉我 谢谢
- 判断软件是否安装
- 关于onkeydown和onchange事件
- 为什么window.open调用不成功
- 加上if(cNode.getAttribute("Text")=="总工办")这句为什么会出错呢?我是想让树控件根据指定的Text如"总工办"使它的结点Checked为True
- 怎样制作一个书本翻页的模版?敬请各位指点。。
- 新窗口定位问题!
- 为什么我用bootstarp3 但是不兼容IE6,7,8,求大神指点
- 如何判断是否匿名函数??
- 关于倒计时程序
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://www.wanmei.com/public/js/jq_132.js"></script>
</head>
<body><div id="one">
<div id="two">hello</div>
<div id="three">word</div>
<div id="four">
<p><a href="#">tonsh</a></p>
</div>
</div>
<script language="javascript">
$("#three").parent().css({'background-color' : 'red', 'font-weight' : 'bolder'});
</script>
</body>
</html>
比如$("#three").parent() 父对象中的第一个对象应该是<div id="two">hello</div>
而且背景色是红的也应该是这一行才对 怎么才能好做到呢
js中一般都是getElementsByTagName('span')[0] 而jquery中就不行
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://www.wanmei.com/public/js/jq_132.js"></script>
</head>
<body><div id="one">
<div id="two">hello</div>
<div id="three">word</div>
<div id="four">
<p><a href="#">tonsh</a></p>
</div>
</div>
<script language="javascript">
$("#three").parent().children('#two').css({'background-color' : 'red', 'font-weight' : 'bolder'});
</script>
</body>
</html>
$("#three").parent().children().eq(0).css({'background-color' : 'red', 'font-weight' : 'bolder'});
嗯 是这个意思 first()换成eq(0)可以了 谢谢!