jquery的 children(’idv’),parent(div)用法
来源:互联网 发布:淘宝网官能卖保健品 编辑:程序博客网 时间:2024/05/20 05:53
1
divid="parentNode"class="treeNode">
Parentnode's text.
<divid="mainNode"class="treeNode">
Thetarget node
<divid="childNode"class="treeNode">
Themain node's child node
</div>
</div>
</div>
<inputtype="button"value="CopyParent Text"id="CopyParent">
<inputtype="button"value="Copy ChildText"id="CopyChild">
CSS Code
div#parentNode {
width:600px;
height:250px;
z-index:10;
}
div#mainNode {
width:400px;
height:180px;
z-index:20;
}
div#childNode {
width:300px;
height:100px;
z-index:30;
}
div.treeNode {
border: 1px solid black;
color: black;
background-color:lime;
margin:20px;
}
jQuery Code
//Use DOM traversal methods to copy theparent node's text to the main node
$('input#CopyParent').click(function(){
varcurrentNodeHTML= $('div#mainNode').html()
varparentText= $('div#mainNode').parent('div').text();
$('div#mainNode').html(parentText+currentNodeHTML);
})
//Use DOM traversal methods to copy thechild node's text to the main node
$('input#CopyChild').click(function(){
varcurrentNodeHTML= $('div#mainNode').html()
varchildText = $('div#mainNode').children('div').text();
$('div#mainNode').html(childText+currentNodeHTML);
})
- jquery的 children(’idv’),parent(div)用法
- jquery获取parent,children的使用父亲子类用法
- Jquery的parent,parents与children
- jQuery-parent(exp)用法
- jquery 中查找函数parent ,parents,find和children的一点研究
- Vue中$parent 和$children的使用
- vue组件($children,$refs,$parent)的使用
- vue组件($children,$refs,$parent)的使用
- (javascript)parent的用法
- jquery使用find,parent,children,next,prev等方法判断取得值是否为空的方法
- children与parent
- YUM的使用[IDV.COM]
- jquery .children("li") 的调用
- jQuery-parent(exp)用法 学习笔记九
- jquery 中 closest和parent用法
- jquery遍历元素children、find、parent、parents、parentsUntil、next、prev、siblings、closest、filter、not
- Jquery的parent和parents
- Cognos函数(八) - parent & children
- htllo
- 黑马程序员--张孝祥老师交通灯管理系统_学习笔记及心得
- 纯css2制作三角形
- reinterpret_cast例子
- 读discuzx3.1 数据库层笔记
- jquery的 children(’idv’),parent(div)用法
- CentOS 6.4安装配置LAMP服务器(Apache+PHP5+MySQL)
- ArraySizeHelper解析
- poj 3669 Meteor Shower (bfs)
- Dropwizard:用Java轻轻的写一个RESTful Service
- Android Matrix理论与应用详解
- 百度最新面试题集锦
- 第一个空白的python图形界面(三)
- 基于visual Studio2013解决C语言竞赛题之1084完全平方数