Enej Bajgoric wrote: > can someone expalin to me how before works in jQuery and how would you > place a link before a container that would hide and show that > container? > Thanks > Enej
before() adds the given content right before the specified context, as a sibling and not at first element (so it is not similiar to the :before pseudo element selector in CSS). Here's what I would do for what you need: HTML: <div id="container">...</div> JS: var jqContainer = $('#container'); jqContainer.before('<a href="#">Toggle</a>').prev('a').click(function() { jqContainer.toggle(); }); With jQuery 1.0 you would have to put an end() at the end of the chain to undo prev(): jqContainer.before('<a href="#">Toggle</a>').prev('a').click(function() { jqContainer.toggle(); }).end(); -- Klaus _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/