Hey guys, I realized that I misstated my problem. I realized that the item I want to check for is NOT a child, but the element that comes AFTER a specific element. So, I have a list of specific elements, and if an element with a specific class does not come after the first element, hide the first element.
Sorry this sounds strange. I am trying to create a work around for my CMS. On May 28, 5:53 pm, Hamish Campbell <[EMAIL PROTECTED]> wrote: > You can do it with selectors: > > $('#main:not(:has(*))').hide(); > > Ie - 'select the element with the id "main" that does _not_ contain > any other element'. > > Note that this is different from $('#main:empty') which includes text > nodes. > > On May 29, 12:10 pm, "Michael Geary" <[EMAIL PROTECTED]> wrote: > > > I would do it by checking the DOM directly, just because it's reasonably > > straightforward and very efficient: > > > var $main = $('#main'); > > if( $main[0] && $main[0].firstChild ) $main.hide(); > > > -Mike > > > > I am wondering how I could check if a parent element has > > > children, and it it does not, I would like to hide the parent. > > > > I was looking at something like the following, but I am not > > > sure how to get it to work how I want: > > > > $("#main > *").hide;- Hide quoted text - > > > - Show quoted text -