Reputation: 476
I have 2 variables in JS
var meeting_id = 3; var guest_id = 44; <tr data-guest-id="44" data-meeting-id="3">
how do I that following selector in jQuery?
Upvotes: 0
Views: 173
Reputation: 8151
Using the jQuery Multiple Attribute Selector. You would replace the numbers here with variables.
$('tr[data-guest-id="44"][data-meeting-id="3"]')
Jsfiddle *I used an input so I could demonstrate how it worked.
Upvotes: 2
Reputation: 144739
You can use the attribute equals selector:
var selector = 'tr[data-meeting-id="'+meeting_id+'"][data-guest-id="'+guest_id+'"]';
$(selector).foo();
Upvotes: 2