当前位置:网站首页>JS operation DOM node
JS operation DOM node
2022-07-27 15:41:00 【IT_ wangxianda】
Recent learning Vue,Vue Auto resolve template , It is found that there is no node operation , But often a case may be used js, And Vue Think in contrast , Study , But actually js The node operation is almost forgotten , Learn from today and review again .
The first category Operate through the element type method :( This method is used most )
document.getElementById();//id name ,
document.getElementsByTagName();// Tag name
document.getElementsByClassName();// Class name
document.querySelector();// Returns the first element that matches the pattern , The result is an element ;
document.querySelectorAll()// Returns all elements that match the pattern , The result is an array of classes
The second category ( Generally, it refers to the acquisition of relationship element nodes after element acquisition )
parentNode// Gets the parent of the selected node , The top node is #document
childNodes // Get the children of the selected node
firstChild // Get the first child of the selected node
lastChild // Gets the last child of the selected node
nextSibling // Gets the next sibling of the selected node
previousSibling // Get the previous node
Correct the mistakes
边栏推荐
- C语言:三子棋游戏
- 【云享读书会第13期】音频文件的封装格式和编码格式
- Leetcode 191. number of 1 bits bit operation /easy
- JS uses extension operators (...) to simplify code and simplify array merging
- 【剑指offer】面试题42:连续子数组的最大和——附0x80000000与INT_MIN
- Leetcode 240. search two-dimensional matrix II medium
- 折半插入排序
- [正则表达式] 单个字符匹配
- Spark 3.0 adaptive execution code implementation and data skew optimization
- [正则表达式] 匹配分组
猜你喜欢
随机推荐
直接插入排序
后台返回来的是这种数据,是什么格式啊
【剑指offer】面试题45:把数组排成最小的数
传美国政府将向部分美企发放对华为销售许可证!
【剑指offer】面试题49:丑数
[正则表达式] 匹配多个字符
HaoChen CAD building 2022 software installation package download and installation tutorial
Database: use the where statement to retrieve (header song)
实现自定义Spark优化规则
Static关键字的三种用法
Leetcode 240. search two-dimensional matrix II medium
Leetcode 781. rabbit hash table in forest / mathematical problem medium
Pytorch replaces some components in numpy. / / please indicate the source of the reprint
Network equipment hard core technology insider router Chapter 21 reconfigurable router
go语言慢速入门——go运算符
Multi table query_ Sub query overview and multi table query_ Sub query situation 1 & situation 2 & situation 3
Use double stars instead of math.pow()
复杂度分析
Network equipment hard core technology insider router 20 dpdk (V)
Leetcode 1143. dynamic programming of the longest common subsequence /medium








