I have a variable which I define by:
if($(this).hasClass('firstName')){
lastname = $(this)
current='.first-name'
}
I have to use this variable in jQuery selector. I tried the following but it doesn't work:
$('.invitePartners' + current + '[data-index]')
May be spaces between them as you may want descendant selector.
Else you will have a value like
.invitePartners.first-name[data-index]which will look for an element with classinvitePartnersandfirst-namewhich also have an attributedata-index(something like<div class="invitePartners first-name" data-index="1"></div>)