Q:

using variable with jquery selector

I have following lines of code and I want to use visibleoffer variable as selector. How can I concatenate it?
var visibleoffer = '.' + obj.parents('tbody').attr('providername') + ' .visible-offers'; //visibleoffer = .Txy .visible-offers
$(obj).parents('.Provider').find(".Offers:not(.HideByProviderFilter,.HideByMainFilter,.HideByProviderFilter.HideByMainFilter,+ visibleoffer)").length;

So it becomes:
$(obj).parents('.Provider').find(".Offers:not(.HideByProviderFilter,.HideByMainFilter,.HideByProviderFilter.HideByMainFilter,.Txy .visible-offers)").length;

A:

You need to concatenate variable while building selector string:
$(obj).parents('.Provider').find(".Offers:not(.HideByProviderFilter,.HideByMainFilter,.HideByProviderFilter.HideByMainFilter," + visibleoffer +")").length;

