jQuery 获取兄弟元素的几种不错方法

上传:weixin_49162 浏览: 13 推荐: 0 文件:PDF 大小:23.08KB 上传时间:2020-12-13 15:40:31 版权申诉
获取指定元素的兄弟元素时,可以使用adjacent sibling combinator (+),其中+的两侧内容都是selector expression. 如果要获取下例中所有的 h1的直接兄弟元素h2 代码如下: Main title Section title Some content... Section title More content... 可以直接使用 代码如下: $(‘h1 + h2’) // Select ALL h2 elements that are adjac
上传资源
用户评论