假设我得到3个属性:
var uid = $("#main_container").attr("uid");
var ticker = $("#main_container").attr("ticker");
var exchange = $("#main_container").attr("exchange");
我想获得与这3个属性匹配的锚标记。关于在哪里放置引号,我不知道怎么做。它会是:
$('a[uid='+uid+'][ticker='+ticker+'][exchange='+exchange+']')
或
$('a[uid="'+uid+'"][ticker="'+ticker+'"][exchange="'+exchange+'"]')
答案 0 :(得分:2)
我认为只是你错过了括号(使用<>
代替()
)
$('a[uid="' + uid + '"][ticker="' + ticker + '"][exchange="' + exchange + '"]')