1

I have a page with many panels on it, each one shown as a thumbnail. The data for the thumbnails is extracted from a database, so basically the code is as follows:

while ($courant = $sth->fetch()) {
    echo '<div class="panel panel-default inline" big=".$courant->big.">
            <div class=panel-body>
              <a class="box" href="something"><img src="some other thing"/>
              </a>
            </div>
          </div>';
}

The big attribute in the main div is either 0 or 1. How can I show/hide div blocks that have big=0 on a checkbox toggle with JavaScript/jQuery? I know there's a hide() function but I think it only works on classes and ids.

j08691
  • 204,283
  • 31
  • 260
  • 272
BlackDog
  • 197
  • 2
  • 14
  • Avoid making up your own attributes. Instead, use the custom data attribute `data-`. For example, `data-big="0"` – j08691 Sep 24 '14 at 16:57
  • possible duplicate of [Select elements by attribute with JQuery](http://stackoverflow.com/questions/1097522/select-elements-by-attribute-with-jquery) – Waxen Sep 24 '14 at 16:58

1 Answers1

1

You can use attribute selector:

$('[big="0"]').hide();
Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231