开发者

jquery multi match

How to do a multi match in jquery? match id = a 开发者_C百科+ num + b + num or id = a + num + c + num(num range from 1-99)? Thanks.

if($(this).attr("id").match(/^a\d{1,2}b\d{1,2}$/), $(this).attr("id").match(/^a\d{1,2}c\d{1,2}$/)) 
//only work the last match


Could you just put an or in your regex -

if($(this).attr("id").match(/^a\d{1,2}b\d{1,2}$|^a\d{1,2}c\d{1,2}$/)) 
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜