Ver Mensaje Individual
  #2 (permalink)  
Antiguo 21/12/2009, 08:49
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: Abrir y cerrar div Jquery

porque estas modificando el id del enlace creo que eso ya es un elemento nuevo, para eso tienes que usar el evento live

Código HTML:
$("#ocultar").live('click', function(event){
    event.preventDefault();
    $("#welcome").hide("slow");
    $('#ocultar').html(' Abrir ');
    $('#ocultar').attr("id","mostrar");

});

$("#mostrar").live('click',function(event){
    event.preventDefault();
    $("#welcome").show(3000);
    $('#mostrar').text(' Ocultar ');
    $('#mostrar').attr("id","ocultar");
});

pero para hacer eso yo utilizaria toggle que se usa para ejecutar 2 funciones en forma alternada

Código HTML:
$("#ocultar").toggle(function(){
    $('#welcome').hide("slow");
    $(this).text("Mostrar");
},function(){
    $('#welcome').show(3000);
     $(this).text("Ocultar");
});