I'm not sure exactly what it is you are trying to do, so can't answer with exact code but this code will make all divs have a click event that will hide all divs except the one you clicked on.
$('div').click(function(){ $('div').not($(this)).hide(); }); Try thinking in terms of all of the selector options instead of just ids. When clicking on an a tag with a class of className, the following code will hide all divs except for the div with and index of 3. $('.className a').click(function() { $('div').not($('div :eq(3)').hide(); }); Hopefully, you can adapt the above logic to what you need. The above code also hasn't been tested, so might not work without some adjustment. On Nov 26, 5:47 pm, "David Andrews" <[EMAIL PROTECTED]> wrote: > Hey Steve, > > I think regex is possible in the selector so using \\S* as your wildcard.. > > $('#contact_\\S*').each(); > > Sorry haven't tested the above - but hope it helps you out. > > Dave > > -----Original Message----- > From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On > Behalf Of [EMAIL PROTECTED] > Sent: 26 November 2008 16:18 > To: jQuery (English) > Subject: [jQuery] trying to act on certain DIV's and not others > > Hi folks, > apologies if this is a completely noob question. I wish to close > (hide) and number of <div>'s whilst leaving others open. I considered the > possibility that it might be feasible in Jquery to act on div's with a > certain pattern in the id name. Not sure if this is true tho; for example > > <div id-="contact_blah"> > <div id="contact_yak"> > <div id="nothanks"> > > so that the first two div's would be subject to being hidden, and the third > left alone. > > I wish essentially to have a series of links toggle the visibility of some > div's, but when a link is clicked and a div is unhidden, - all other divs to > hide. > > Any ideas? > > best wishes and thanks > > Steve / Nibb