没有合适的资源?快使用搜索试试~ 我知道了~
就是contains这个函数,书上介绍说这个函数是按照元素的内容来来筛选选择的元素集,当我运行代码的时候老是报错,后来发现是函数库里没有这个函数,于是自己写了这个函数。 代码如下: 复制代码 代码如下: function yhCheckIsIncludingValue(element , pattern) { var bool = false; var childrenNodes = element.childNodes; if (childrenNodes.length == 0) { if (element.nodeValue != null) { if (pattern.exec(ele
资源详情
资源评论
资源推荐
![](https://csdnimg.cn/release/download_crawler_static/13717768/bg1.jpg)
php实现实现jQuery扩展函数扩展函数
就是contains这个函数,书上介绍说这个函数是按照元素的内容来来筛选选择的元素集,当我运行代码的时候老是报错,后来
发现是函数库里没有这个函数,于是自己写了这个函数。
代码如下:
复制代码 代码如下:
function yhCheckIsIncludingValue(element , pattern)
{
var bool = false;
var childrenNodes = element.childNodes;
if (childrenNodes.length == 0)
{
if (element.nodeValue != null)
{
if (pattern.exec(element.nodeValue) != null)
{
return true;
}
}
}
if (childrenNodes.length != 0)
{
for (var i = 0 ; i < childrenNodes.length ; i++)
{
if (bool = yhCheckIsIncludingValue(childrenNodes , pattern)) break;
}
}
return bool;
}
//在函数链应用这个函数
$.fn.contains = function(text)
{
var text = $.trim(text);
if (text == ‘undefined’) return this;
var pattern = new RegExp(text , ‘i’);
return this.filter(function(){
return yhCheckIsIncludingValue(this , pattern);
});
}
在IE浏览器上运行正常,不知道其他的浏览器会出现什么情况?
您可能感兴趣的文章您可能感兴趣的文章:PHP 检查扩展库或函数是否可用的代码php smarty函数扩展编写自己的php扩展函数非常实用的php弹出
错误警告函数扩展性强PHP链接MySQL的常用扩展函数PHP7扩展开发之基于函数方式使用lib库的方法详解PHP获取和操作
配置文件php.ini的几个函数介绍PHP配置文件中最常用四个ini函数PHP最常用的ini函数分析 针对PHP.ini配置文件PHP 的几个
配置文件函数PHP parse_ini_file函数的应用与扩展操作示例
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![docx](https://img-home.csdnimg.cn/images/20210720083331.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![js](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![downlist](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![downlist](https://img-home.csdnimg.cn/images/20210720083646.png)
![downlist](https://img-home.csdnimg.cn/images/20210720083646.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
weixin_38660579
- 粉丝: 11
- 资源: 918
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)
评论0