BlackDog
BlackDog

Reputation: 317

Show/hide depending on attribute

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.

Upvotes: 1

Views: 146

Answers (1)

Bhojendra Rauniyar
Bhojendra Rauniyar

Reputation: 85545

You can use attribute selector:

$('[big="0"]').hide();

Upvotes: 1

Related Questions