$('div a.hide').live( "click", function(){ $(this).parent().next().hide(); $(this).replaceWith("<%= t(:show) %>"); }); $('div a.show').live( "click", function(){ $(this).parent().next().show(); $(this).replaceWith("<%= t(:hide) %>"); });