hasClassLike

程序名称:hasClassLike

hasClassLike 介绍

hasClassLike allows the selection of elements based on pattern matching rather
than specific names. This allows, for example, the passing of parameters to
JavaScript via class names:

/* in js, such as in $(document).ready */ $("*") .hasClassLike("integer") /* filter some before using regexp */ .hasClassLike(/^integer(?:Min(-?\d+))?(?:Max(-?\d+))?$/,function(m) { var min = m[1]; var max = m[2]; // ... install validating event handlers on $(this) ... });

<!-- in HTML --> <input type="text" class="someOtherClass integerMin0"/> <input type="text" class="integerMin-100Max100 someOtherClass"/> <input type="text" class="someOtherClass integer yetAnotherClass"/>

There is an efficient simple substring match .hasClassLike(str) matched
against the entire className of the element (that is, the space-separated
list), useful for paring out unlikely elements. Then, a RegExp match with
.hasClassLike(rx) comes back with the elements bearing at least one class
matching a given pattern. Adding a callback function with .hasClassLike(rx,fn)
makes it easy to modify or filter the found elements based on the match, which
is passed to the callback function. If the callback returns false, the element
is not included in the output (like with .filter).

hasClassLike 官网

http://plugins.jquery.com/project/hasClassLike

相关编程语言

多功能下拉选择插件 SelectPage 简洁而强大的下拉分...
AutoComplete 是一个 jQuery Mobile 的插件,用于实...
Combogrid 是一个jQuery插件用于为输入框添加高级自...
Autobox2这个jQuery插件,可以用于创建类似于Facebo...
Link Scraper TextBox 是一个文本框的扩展插件,当你...
Awesomplete 超小超好用的超漂亮的 autocomplete 框...