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:
$("[id^=pnl]").hide();
You can even narrow it to only divs like this:
$("div[id^=pnl]").hide();
There is another example with even more explanations over here.
This entry was posted
on Saturday, July 25th, 2009 at 9:27 am and is filed under Programming.
You can follow any responses to this entry through the RSS 2.0 feed.
Both comments and pings are currently closed.
