Reputation: 3146
I try to select element by attribute with code below
$('dt[data-panel="2"] h2').html();
but this doesn't work for
<dl>
<dt data-panel="panel-2">
<h2 class="delta expandable">Text</h2>
</dt>
</dl>
am I missing something?
fiddle is here http://jsfiddle.net/u1offsyw/
Upvotes: 1
Views: 41
Reputation: 337714
The value of the attribute is panel-2
, not just 2
, hence your selector needs to be:
$('dt[data-panel="panel-2"] h2').html();
Upvotes: 2