开发者

How to evaluate the following expression in jQuery without eval()?

I have the following code that does开发者_如何学运维n't seem to be OK in context of jQuery:

jQuery.expr[ ":" ].containsNoCase = function( el, i, m ) {
    var search = m[ 3 ];
    if( !search ) return false;
    return eval( "/" + search + "/i" ).test( jQuery( el ).text() );
};

Is there any other way to return result?


I believe you want

new RegExp(search, "i").test(jQuery(el).text());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜