0

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?

2 Answers 2

2

You can use the attribute equals selector:

var selector = 'tr[data-meeting-id="'+meeting_id+'"][data-guest-id="'+guest_id+'"]';

$(selector).foo();
Sign up to request clarification or add additional context in comments.

Comments

2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.