hasClassLike

码农软件 · 软件分类 · 其他jQuery插件 · 2020-01-10 08:14:09

软件介绍

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).

本文地址:https://codercto.com/soft/d/23053.html

秩序之美

秩序之美

Vinh / 人民邮电 / 2011-5 / 35.00元

怎样才能设计出简洁大方而不落于俗套的超人气网站?纽约时报网站的资深设计师Khoi Vinh在这《秩序之美——网页中的网格设计》一书中将为你揭示其中的奥秘。   《秩序之美——网页中的网格设计》将源自传统平面设计、被众多平面设计大师推崇的网格设计方法应用于网页设计,向读者详细介绍了网格设计成熟而经典的设计模式,并以整个网站的设计为例,对工作流程、设计工具和方法进行了系统而全面的介绍,手把手教读......一起来看看 《秩序之美》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具