How to enable div that was hide using JQuery

I Have used Ajax and JQuery link to enable new and close functionality problem scenario: * While using ajax link to open the new content and closing the same using Jquery link its working fine wherein the same does not happen again while we try to open the new content immediately after closing the "New content" * The above said works fine only while we refresh the page How to resolve it ?

For example <%= link_to_remote ('New', :url => new_expense_expense_session_path,:update=>"expense_session_new_edit_content") %> <div id="expense_session_new_edit_content"></div>

<a href='#' id='close_session'>close</a> <script type="text/javascript"> $(document).ready(function() { $('a#close_session').click(function(){         $('#expense_session_new_edit_content').fadeOut("1000");     }) }); </script>

This sounds more like a jQuery question then a Rails one, but let's see if I can help anyway. So, you click a link, something happens, then the div hides. You click the link again, something happens, and the div shows up?

<div id="some_div_toggle">With stuff in it</div>

<a href="#" id="some_link_to_click">To toggle div</a>

$(function() {   $('#some_link_to_click').click(function() {     $.ajax({       type: 'get',       dataType: 'json',       success: function(data) {         //do stuff with data         if($('#some_div_toggle').is(':hidden')) {           //show the div         } else {           //hide the div         }       }     });   }); });