On Wed, Jun 17, 2009 at 6:02 PM, Jake Barnes <lawrence.krub...@gmail.com>wrote:
> > > This code works, but it seems inelegant: > > if ($("#subnav-1")[0].style.display == "block") $("#subnav-1") > [0].style.display = "none"; > > This seems to violate The One True jQuery Way: > > [0] > > I assume I'm not suppose to do that. > > The each() method is more elegant, but it is more verbose: > > $("#subnav-1").each(function() { > if (this.style.display == "block") this.style.display = "none"; > } > > Curious if there is another, shorter way to do this? > $("#subnav-1").each(function() { this.toggle(); } -- I have failed as much as I have succeeded. But I love my life. I love my wife. And I wish you my kind of success.