Oracle Apex: Refresh Current Region Using JavaScript

In this tutorial, we will explore how to refresh the current region in your Oracle Application Express (APEX) application using JavaScript. To achieve this, we will make use of the apex.region.findClosest JavaScript function provided by Oracle APEX. This function allows us to locate the region containing a specific DOM element and subsequently trigger a refresh action on that region.


Before you proceed with this tutorial, ensure that you have the following prerequisites in place:

  • An Oracle APEX application set up.
  • Basic knowledge of HTML, JavaScript, and Oracle APEX concepts.

Understanding apex.region.findClosest

The apex.region.findClosest function is a powerful tool in Oracle APEX that helps identify the region containing a given DOM element. It returns a region interface or null if the element corresponding to the provided target is not inside a region. Here's the function signature for reference:

apex.region.findClosest(pTarget) → {region|null}


  • pTarget: This parameter can be either a DOM element or a CSS selector suitable as the first argument to the jQuery function.

Refresh Current Region Using JavaScript Example

Let's start with a practical example to illustrate how to use apex.region.findClosest to refresh a region when a button is clicked.

apex.jQuery(".refresh-button").click(function(event) {
    var region = apex.region.findClosest(;
    if (region) {

In this example:

  • We attach a click event handler to elements with the class refresh-button.
  • When the button is clicked, it triggers the function.
  • Inside the function, we use apex.region.findClosest( to locate the region containing the clicked button.
  • If a valid region is found, we call the refresh method on that region to refresh its content.

Now, let's break down the steps involved in creating such functionality in your Oracle APEX application.

Step-by-Step Tutorial

Step 1: Identify the Region to Refresh

The first step is to identify the current region you want to refresh when an event occurs. This could be a button click, a change in a select list, or any other user interaction event.

For this example, we will use a button with the class refresh-button as the trigger to refresh a specific region.

Step 2: Add JavaScript Code

Next, you need to add JavaScript code to your APEX page or application. You can do this by navigating to the appropriate page or region attributes and finding the "JavaScript" section.

In this section, you can either include the JavaScript code directly or reference an external JavaScript file.

Here's an example of the JavaScript code to be added:

apex.jQuery(".refresh-button").click(function(event) {
    var region = apex.region.findClosest(;
    if (region) {
Refresh current region using JS in Oracle Apex.

This code will listen for clicks on elements with the class refresh-button and, when clicked, identify the containing region and refresh it.

Step 3: Test Your Application

After adding the JavaScript code, save your changes and run your Oracle APEX application. Navigate to the page containing the button or element you want to use for triggering the region refresh.

Click the designated button or perform the action that should trigger the region refresh. If everything is set up correctly, you should see the specified region refresh its content without requiring a full page reload.


In this tutorial, you've learned how to refresh the current region in your Oracle APEX application using JavaScript. By using the apex.region.findClosest function, you can target the exact region you want to refresh, providing a smoother and more responsive user experience in your APEX applications.

Feel free to explore further and adapt this technique to suit your specific APEX application requirements. Happy coding!



Written by Editorial Staff

The Editorial Team at FoxInfotech is a group of highly skilled computer software and hardware experts, under the capable leadership of Vinish Kapoor, who boasts more than two decades of extensive experience in Software Development, Hardware Engineering, Cloud Computing, Artificial Intelligence, and related fields. Established in 2014, FoxInfotech has since been a trusted source of expertise in the tech world.

Leave a Reply

Your email address will not be published. Required fields are marked *