你就把那个$()里的字符串拼起来就行了
$("#"+$match_url_1+" "+a[title])
【 在 cowell (紫禁飞狐) 的大作中提到: 】
: 标 题: jQuery: 如何用变量来作过滤
: 发信站: 水木社区 (Thu Jul 20 07:52:43 2017), 站内
:
:
: 有个包含很多链接的<li>队列,形如:
: <ul id="liArray">
: <li><a href='
http://xyz' title='title'>link here</a></li>
: ……
: </ul>
: 第一步是用下面这个做过滤来着。
: $match_url_1 = $("#liArray a[href]").filter(function() { return (re_1.test($(this).attr('href'))) }).parent();
: 现在要对$match_url_1作二次过滤,该如何替换"#liArray"的部分?类似下面写法(但不正确)
: $match_url_2 = $("$match_url_1 a[title]").filter(function() { return (re_2.test($(this).attr('title'))) }).parent();
:
:
: --
:
: ※ 来源:·水木社区
http://www.newsmth.net·[FROM: 192.55.54.*]
--
FROM 111.47.10.*