I'm still confused about one thing though. How does the else portion work? Sorry for being such a noob, but I haven't been able to find the syntax using "IS" as an if statment through Jquery.
On Aug 3, 10:57 am, "Ganeshji Marwaha" <[EMAIL PROTECTED]> wrote: > Yes, is() method returns true/false. This is one of the few methods which > doesnt return a jquery object because it makes more sense to return boolean. > > -GTG > > On 8/3/07, spinnach <[EMAIL PROTECTED]> wrote: > > > > > try it like this, .is() returns true or false so you have to use it in > > an if statement: > > > $("a.saveConfig").click(function() { > > if ($('div.detail').is(':visible')) alert('Hey this works'); > > }); > > > dennis. > > > Pete wrote: > > > I'm trying to create a link that when clicked will produce an alert if > > > there are any visible divs (all .detail divs are hidden by default). > > > I have the following function but it doesn't seem I'm doing it > > > correctly; nothing happens regardless of the visibility status of the > > > divs. > > > > $("a.saveConfig").click(function() { > > > $('div.detail').is(':visible'), (function () { > > > alert('Hey this works'); > > > > }); > > > }); > > > > Is there a better way to do an if statement using JQuery selectors or > > > is there something I'm missing in my code?