In order to have a section of a webpage toggle on and off, I need to use the toggle function that is provided by jquery.

In this example, the search partial is turned on or off with the Hide/Show Search link. When you first visit the page, the partial is shown.

<%= link_to_function 'Hide/Show Search', "$('#search').toggle()" %>




However, I wanted the page to default to the search partial not being shown. To do that, add the style to the div as below.

<%= link_to_function 'Hide/Show Search', "$('#search').toggle()" %>