当前位置:网站首页>JS locate Daquan to get the brother, parent and child elements of the node, including robot instances
JS locate Daquan to get the brother, parent and child elements of the node, including robot instances
2022-07-24 09:12:00 【51CTO】
One 、js Positioning brother , Parent , The child element
<div id="test">
<div></div>
<div></div>
</div>
all DOM Method
Native JS obtain ID by test The child element under the element of . It can be used :
var a = docuemnt.getElementById("test").getElementsByTagName("div"); There's no problem
here a.length=2;
Let's introduce JQUERY The father of , Son , Brother node search method
jQuery.parent(expr) Find the father node , You can pass in expr To filter , such as $("span").parent() perhaps $("span").parent(".class")
jQuery.parents(expr), Be similar to jQuery.parents(expr), But it's looking for all the ancestral elements , Not limited to the parent element
jQuery.children(expr). Return all child nodes , This method will only return the direct child node , Not all descendant nodes will be returned
jQuery.contents(), Return to everything below , Include nodes and text . This method and children() The difference is , Include blank text , It will also be used as a
jQuery Object returns ,children() Then only nodes will be returned
jQuery.prev(), Return to the previous sibling node , Not all sibling nodes
jQuery.prevAll(), Return all previous sibling nodes
jQuery.next(), Return to the next sibling , Not all sibling nodes
jQuery.nextAll(), Return all subsequent sibling nodes
jQuery.siblings(), Return to sibling node , No matter before or after
jQuery.find(expr), Follow jQuery.filter(expr) Totally different .
jQuery.filter() From the beginning jQuery Filter out a part of the object collection , and
jQuery.find() Return result of , There will be no content in the initial set , such as $("p"),find("span"), It's from <p> Elements start looking for <span>, Equate to $("p span")
robotframework example :
example 1:

example 2:


边栏推荐
- 科目1-3
- Detailed explanation of the whole process of R & D demand splitting | agile practice
- Detailed sequence traversal of leetcode102 binary tree
- 超全总结:Go语言如何操作文件
- Six pictures show you why TCP shakes three times?
- LeetCode刷题系列-- 174. 地下城游戏
- The difference between classification and regression
- Taking advantage of the momentum, oceanbase promotes the lean growth of digital payment
- Pulse netizens have a go interview question, can you answer it correctly?
- What is the component customization event we are talking about?
猜你喜欢

03_ UE4 advanced_ illumination

Account 1-3
![[FFH] openharmony gnawing paper growth plan -- Application of cjson in traditional c/s model](/img/a5/a8f4371a83fbd38c40aa7ba56a36d3.png)
[FFH] openharmony gnawing paper growth plan -- Application of cjson in traditional c/s model

js定位大全获取节点的兄弟,父级,子级元素含robot实例

Little dolphin "transformed" into a new intelligent scheduling engine, which can be explained in simple terms in the practical development and application of DDS

Discuz论坛搭建详细过程,一看就懂

Data center: started in Alibaba and started in Daas

gnuplot软件学习笔记

One click openstack single point mode environment deployment - preliminary construction

C语言练习题目+答案:
随机推荐
Tiktok shop platform will take disciplinary measures against sellers who violate rules and policies
如何将CAD文件导入图新地球中,与影像地形倾斜模型准确叠加
科目1-3
JS problem summary
How to judge and analyze NFT market briefly through NFT go?
Taking advantage of the momentum, oceanbase promotes the lean growth of digital payment
Super complete summary: how to operate files in go language
Let's test 5million pieces of data. How to use index acceleration reasonably?
Wildcards in MySQL like statements: percent, underscore, and escape
Vector control of permanent magnet synchronous motor (I) -- mathematical model
How to open the port number of the server, and the corresponding port of common network services
Developing ebpf program with go language
Detailed explanation of the whole process of R & D demand splitting | agile practice
SQL 优化原则
Unity C#工具类 ArrayHelper
Problems and abuse of protocol buffers
Houdini 笔记
我们说的组件自定义事件到底是什么?
CodeBlocks shortcut key operation Xiaoquan
Description of MATLAB functions