I want to be able to grab html5 attribute values and have them match the value and attribute name with the class - then hide on click.
for example data-table="sample11" should hide class="sample11" same for sample14 and any other attributes on this page
I was trying something like this but it isn't working for me - below is the way i am trying to do this - here is my fiddle http://jsfiddle.net/breezy/xq6epy39/
Any help or guidance would be helpful. Thanks!
<div data-table="sample11">
<a href="#">when i click this 'hide this' in sample11 should hide</a>
</div>
<div class="sample11">
hide this
</div>
<div data-table="sample14">
<a href="#">when i click this 'hide this' in sample14 should hide</a>
</div>
<div class="sample14">
hide this
</div>
jQuery
var sample = $('div').data("table") === "11";
sample.click(function() {
$('.sample11').hide();
});