javascript file
$('#user a').toggle(function(){
//first function here
$('#nav #user-menu').show();
//$('#nav #user .profile, .account, .logout').show();
},
function(){
// second function here
$('#nav #user-menu').hide();
//$('#nav #user .profile, .account, .logout').hide();
});
main.html.erb
<div id="nav">
<% if !session[:user_id] %>
<%= link_to "Please login" , :action => 'login' %>
<%= link_to "Register", :action => 'register'%>
<% else %>
<div id="user"><%= link_to "#{@user.username}"%>
<div id="user-menu">
<div class="profile"><%= link_to "Profile" ,:controller => 'users', :action => 'profile'%></div>
<div class="account"><%= link_to "Account" ,:controller => 'users', :action => 'account'%></div>
<div class="logout"><%= link_to "Logout" , :action => 'logout'%></div>
<div class="clear"></div>
</div>
</div>
</div>
on toggling the user-menu div visibility is working properly but on clicking on the profile , logout and other links , they arent functioning as expected but if i remove the toggle condition and visibility from javascript then the link are working just fine please help