How do I query this in Javascript?
<div class="room" data-people="jason">
blah blah
</div>
$(".room with attribute "data开发者_如何学C-people=jason").hide();
I want to select the room where data-people = jason, and then hide it.
<div class="room" data-people="jason">
blah blah
</div>
<script>
$(".room[data-people='jason']").hide();
</script>
demo
Like this:
$(".room[data-people=jason]").hide();
This should do the trick:
$('.room[data-people=jason]').hide();
$('.root[data-people="jason"]').hide()
精彩评论