Reputation: 27114
I have this object..
$object = $(".service-box:first").attr("rel")
# => "spaghetti"
I am trying to find the this object inside of a selector..
$(".hqs-text[rel=$object]")
But this is an innapropriate way to use dynamic variables in this selector.
How can I do this correctly?
Thanks!!!
Upvotes: 0
Views: 76
Reputation: 219938
Simple concatenation will do:
$(".hqs-text[rel=" + $object + "]");
Or even all in one line:
$(".hqs-text[rel=" + $(".service-box:first").attr("rel") + "]");
Upvotes: 5