Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

322
Vistas
I made a similar code, but it does not work, I can’t understand why, the class and the attribute are added to the button, but event show does not fir

I can't figure out why it doesn't work I made a similar code, but it does not work, I can’t understand why, the class and the attribute are added to the button, but event show does not fire and it’s impossible to add a class to element popup_cart as if it doesn’t exist

$(document).ready(function(){
    $(document).on("click", "#user_panel", function(){
        if(typeof $(this).attr('click') === "undefined"){   
            $(this).attr('click', 'active' );
            $(this).addClass('active_e');
            $('#popup_user_panel').show();
        }else{
            $(this).removeAttr('click', 'active' );
            $(this).removeClass('active_e');
            $('#popup_user_panel').hide();
        }
    });
    $(document).mouseup(function (e) {
        var container = $('.top_right_nav');
        if (container.has(e.target).length === 0){
            $('#user_panel').removeClass('active_e');
            $('#user_panel').removeAttr('click', 'active' );
            $('#popup_user_panel').hide();
        }
    });
    
    $(document).on("click", "#panel_bag", function(){
        if(typeof $(this).attr('click') === "undefined"){   
    
            $(this).attr('click', 'active' );
            $(this).addClass('active_e');
            $('#popup_cart').show();
        }else{
            $(this).removeAttr('click', 'active' );
            $(this).removeClass('active_e');
            $('#popup_cart').hide();
        }
     });
     $(document).mouseup(function (e) {
        var container = $('.top_right_nav');
        if (container.has(e.target).length === 0){
            $('#panel_bag').removeClass('active_e'); 
            $('#panel_bag').removeAttr('click', 'active' );
            $('#popup_cart').hide();
        }
    });
});

enter image description here

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The problem is solved, in my code the element is duplicated for the mobile and full versions of the site. Thanks Tadas!

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda