Question

Suppose I get 3 attributes:

var uid = $("#main_container").attr("uid");
var ticker = $("#main_container").attr("ticker");
var exchange = $("#main_container").attr("exchange");

I want to get the anchor tag that matches those 3 attributes. I'm not sure how to do that with regards to where to put the quotes. Would it be:

$('a[uid='+uid+'][ticker='+ticker+'][exchange='+exchange+']')

or

$('a[uid="'+uid+'"][ticker="'+ticker+'"][exchange="'+exchange+'"]')
Était-ce utile?

La solution

I think it is just that you have missed the parenthesis(used <> instead of ())

$('a[uid="' + uid + '"][ticker="' + ticker + '"][exchange="' + exchange + '"]')
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top