A A
RSS

jQuery Wildcard Selector

Sat, Jul 25, 2009

Programming

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.

Tags: ,

Comments are closed.

Advertise Here
The Most Intelligent Add-In To Visual Studio Happy fan of

What I'm Doing...

Yonkly Open Source

Sign up for my newsletter




* = required field

powered by MailChimp!

megree Widget

Apparently, I am connected to Obama. Check this out...
My path to Obama

Cyber Identity