PHP implementation jquery extended function _php skills

Source: Internet
Author: User
is contains this function, the book said this function is based on the content of elements to filter the selection of elements set, when I run the code always error, and later found that the function library does not have this function, so I wrote this function.
The code is as follows:
Copy Code code as follows:

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;
}
Apply this function in the function chain
$.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);
});
}

Running normally on IE browser, do not know what will happen to other browsers?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.