jQuery Wildcard Selector

This post is a reminder for me on how to do wildcard selection in jQuery.  It comes up more than you think and for some reason, I can never remember it.

<div id='pnlUsers'></div>
<div id='pnlMessages'></div>
<div id='pnlStatus'></div>

I can easily hide all the divs up by doing a wildcard selection on elements with an id starting with “pnl”, like this:


You can even narrow it to only divs like this:


There is another example with even more explanations over here.