Topic: Hide/Show toggle without ajax, but with javascript

Just curious:  I'm pretty new to javascript/ajax/rails.  I'd like to implement a toggle button that shows or hides some admin related links on a web page.  It would make sense to me that I could tag all admin-related DOMs with special admin-class.

So then, when an admin clicks on show/hide toggle, it would either hide or display the admin links, and I'd think that this really shouldn't require an ajax call back to the server.  So I'm thinking there'd be some javascript function that does just that.

Is there a pre-packaged utility function that I can use to do this sort of thing?  It's pretty basic. 

While I'm asking, I've read that internet explorer has some issues with DOM related javascript relating to tables, is that right?  What should I know (if anything) if I plan on showing/hiding a table column via javascript?

Re: Hide/Show toggle without ajax, but with javascript

by the way, I've got the functionality working with ajax.  I just realized that I really ought not have implemented it in this way though, at least not for the entire page.  I may still make an ajax call, because the toggle button ought to really update an admin panel partial, but for the main content -- that shouldn't require an ajax reload (as it where).

Re: Hide/Show toggle without ajax, but with javascript

If you are using prototype, this Javascript will work I think.

<a href="#" onclick="Element.toggle('some_div')">Toggle!</a>


Railscasts - Free Ruby on Rails Screencasts