TIMEX
TIMEX

Reputation: 272174

How do I query this in Javascript?

    <div class="room" data-people="jason">
    blah blah
    </div>

$(".room with attribute "data-people=jason").hide();

I want to select the room where data-people = jason, and then hide it.

Upvotes: 0

Views: 68

Answers (4)

yoavmatchulsky
yoavmatchulsky

Reputation: 2960

$('.root[data-people="jason"]').hide()

Upvotes: 1

Jan Aagaard
Jan Aagaard

Reputation: 11194

This should do the trick:

$('.room[data-people=jason]').hide();

Upvotes: 1

genesis
genesis

Reputation: 50982

   <div class="room" data-people="jason">
     blah blah
   </div>
   <script>
       $(".room[data-people='jason']").hide();
   </script>

demo

Upvotes: 2

aorcsik
aorcsik

Reputation: 15552

Like this:

$(".room[data-people=jason]").hide();

Upvotes: 1

Related Questions