Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

319
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!