Navigation
This is archived content. Visit our new forum.
  • Author
    Posts
  • #277260
    GerlChristoph
    Participant

    Hello,

    I have a Button in the content of a tab-nav tab and I want to change the active tab when this button is clicked. The Button’s Id is ‘chooseImage’ so i tried using the following custom javascript custom code to achieve this:

    $(document).on('click', "#chooseImage", function(){     
      $('.x-nav-tabs-item a')[1].click();
    });

    I have an Issue here, the active Tab is now the one i want it to be, but the content displayed is still the one of the former active Tab. I appreciate your help.

    You can see the Issue on my page here. It’s the button on the left column in the first tab.

    Greets,
    Christoph

    #277271
    GerlChristoph
    Participant

    Sorry, was a silly Bug. SOLVED!
    It works just as described above.

    #277391
    Lely
    Moderator

    Hello Christoph,

    Glad that this is working now.
    Let us know if you have questions in the future.

    Thanks.

    #292432
    GerlChristoph
    Participant

    Hello,

    I have one more question, is there any event fired when the tab is changed? I want to draw on a canvas when the tab is changed but I can’t find a way to execute some code right when the tab changed.

    Thanks.

    #292998
    Rue Nel
    Moderator

    Hello There,

    You can check the tab if it has the active class. You can try this code:

    (function($){
      if ( $('#tab-ID').hasClass('active') ) {
        //do something here
      }
    })(jQuery);

    Please let us know if this works out for you.

  • <script> jQuery(function($){ $("#no-reply-277260 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>