Thats because the event binding is lost when you replace the element. replaceWith()
essentially removes the element and all its event bindings and then replaces it with a new element. It does not persist the event bindings.
Bind the click event using .on()
instead.
$('.menu').on('click', 'a', function() {
...
});
Updated Fiddle: http://jsfiddle.net/RTPhR/1/