Skip to main content

Command Palette

Search for a command to run...

Oracle APEX: How to Programmatically Switch Tabs using jQuery

Updated
1 min read
Oracle APEX: How to Programmatically Switch Tabs using jQuery

There is no predefined Dynamic Action for switching tabs in Oracle APEX. Therefore, we need to use jQuery to identify the tab and the click() method to simulate the click.

The code below simulates a click on 2nd tab and opens it.

$('#myRegion li.t-Tabs-item:eq(1) a').click();
  1. #myRegion is the static ID of the specific tab region which can be defined at » Right pane of your tab region » Advanced » Static ID

  2. We have put :eq(1) to acces 2nd tab because, indexing in JavaScript starts with 0 and the 1st item (tab) is at index 0, 2nd tab is at index 1 and so on….

How to use this?

You can use this script to switch to a specific tab automatically based on user actions like:

  1. Click on a URL.

     <a href="#" onClick="$('#myRegion li.t-Tabs-item:eq(1) a').click(); return false;"> Click Here </a>
    
  2. Click on a Button.

    Create a Dynamic Action with action type Execute JavaScript Code and use the same JS code there.

  3. Click on a link or buttion attached to an event listner or any other custom code..

Check this post if you are interested to know how to create and use Event listeners Oracle APEX.