jQuery.contains()方法

jQuery 教程 · 2019-03-29 06:59:50

实例

检测一个元素包含在另一个元素之内:

$(function () {
    function funcontain( html ){
        document.body.innerHTML += "<br>" + html;
        }
    funcontain($.contains( document.documentElement, document.body )); // true
    funcontain($.contains( document.body, document.documentElement )); // false
})

定义和用法

$.contains() 方法用于判断指定元素内是否包含另一个元素。即判断另一个DOM元素是否是指定DOM元素的后代。

语法

$.contains( container, contained )

参数 描述
container Element类型 指定可能包含其他元素的祖辈容器元素。
contained Element类型 指定可能被其他元素包含的后代元素。

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Machine Learning

Machine Learning

Kevin Murphy / The MIT Press / 2012-9-18 / USD 90.00

Today's Web-enabled deluge of electronic data calls for automated methods of data analysis. Machine learning provides these, developing methods that can automatically detect patterns in data and then ......一起来看看 《Machine Learning》 这本书的介绍吧!

在线进制转换器
在线进制转换器

各进制数互转换器

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

RGB CMYK 转换工具
RGB CMYK 转换工具

RGB CMYK 互转工具