I'm sorry for my apparent ignorance. I tried your approach and it did not work
DOESN'T WORK http://www.whatbird.com/wwwroot/Alice_1.html jQuery.fn.toggleVis = function() { if(this.style.visibility == 'hidden') { this.style.visibility = 'visible'; } else { this.style.visibility = 'hidden'; } }; WORKS http://www.whatbird.com/wwwroot/Alice_1.html jQuery.fn.toggleVis = function() { if(cheshireCat.style.visibility == 'hidden') { cheshireCat.style.visibility = 'visible'; } else { cheshireCat.style.visibility = 'hidden'; } }; I was under the impression that the object #chesireCat would be the only object affected by this function, and that its using jQuery's ability to figure out the object by name. <div id="cheshireCat"><img src="images/alice24.gif" /></div> Take a look at the code examples and tell me if I am missing something here. Mitch -----Original Message----- From: jquery-en@googlegroups.com [mailto:[EMAIL PROTECTED] On Behalf Of Stephan Beal Sent: Tuesday, July 24, 2007 11:31 PM To: jQuery (English) Subject: [jQuery] Re: Toggling an objects visiblty without show and hide On Jul 25, 12:41 am, "Mitchell Waite" <[EMAIL PROTECTED]> wrote: > I know this is trivial but what it turned out I needed was something this > simple > > jQuery.fn.toggleVis = function() { > > if(chesireCat.style.visibility == 'hidden') { > > chesireCat.style.visibility = 'visible'; > > } else { > > chesireCat.style.visibility = 'hidden'; > > } > > }; Eeeek! What you're doing here is adding a toggleVis() function to ALL selectable jQuery elements, but then in the function you're applying the change to a specific element. Thus this will trigger your function: $('div').toggleVis(); that will toggle the cheshireCat element, not the selected element(s), which certainly isn't desired. What i *think* you meant was to either make that a standalone function (not using jQuery.fn.) or: jQuery.fn.toggleVis = function() { if(this.style.visibility == 'hidden') { this.style.visibility = 'visible'; } else { this.style.visibility = 'hidden'; } };