Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How can someone search a page with tabs, if keyword is on an unopened tab?

Kristin h
Contributor
June 3, 2019

I'm testing the Content Formatting for Confluence plug-in, and I love the look of a page with tabs (using Tab Container and several Tabs Pages). Most of our employees have been using Ctrl + F to search for keywords on a page, but when they're not actually on the tab that has the keyword, the search results are useless. I don't know how to get around this. Search Box only searches Spaces. 

Help, please!

3 answers

0 votes
Dhananjay Kale September 9, 2025

I know its bit late but it worked for me when I use below script in HTML macro on Confluence page:

 

<style>
  .highlight { background: yellow; font-weight: bold; }
</style>

<h3>Search</h3>
<input type="text" id="searchBox" placeholder="Enter keyword..." />
<button onclick="searchTabs()">Search</button>

<script>
let lastQuery = "";
let matches = [];
let currentIndex = -1;

function searchTabs() {
  let query = document.getElementById("searchBox").value.toLowerCase();
  let tabs = document.querySelectorAll(".aui-tabs li a");
  let panes = document.querySelectorAll(".tabs-pane");

  // If new search term entered → reset
  if (query !== lastQuery) {
    lastQuery = query;
    matches = [];
    currentIndex = -1;

    // clear old highlights
    panes.forEach(pane => {
      pane.innerHTML = pane.innerHTML.replace(/<span class="highlight">|<\/span>/g, "");
    });

    // find all matches
    panes.forEach((pane, i) => {
      let text = pane.innerHTML;
      if (text.toLowerCase().includes(query) && query !== "") {
        let regex = new RegExp(query, "gi");
        pane.innerHTML = text.replace(regex, match => `<span class="highlight">${match}</span>`);
        matches.push(i);
      }
    });
  }

  if (matches.length === 0) {
    alert("No match found in any tab.");
    return;
  }

  // move to next match
  currentIndex = (currentIndex + 1) % matches.length;
  let matchTabIndex = matches[currentIndex];

  // activate the matching tab
  tabs[matchTabIndex].click();
}
</script>

 

Hope that helps!!

 

-DJ

0 votes
Robby Holtmann_IntraFind Software AG_
Atlassian Partner
February 1, 2021

Hi @Kristin h 

Hi @dellagustin_sap 

Unfortunately I only saw your entry now. In your both cases our solution could be helpful for your and your colleagues. You can do very easy granular setting of filter, e.g. searching in a space. 

iFinder Confluence Search is available at Atlassian Marketplace and you can start directly with a trial.

Our article in the Atlassian community will give you more information. If you like a demo first, please contact us at atlassian@intrafind.com

Best regards

Robby

Dylan Maxwell June 2, 2022

I took a look at the articles but i don't see how this helps navigate to text within tabs. Can you explain?

I'd like to deliver my searcher directly to the tab which contains the text with a click.

Robby Holtmann_IntraFind Software AG_
Atlassian Partner
June 29, 2022

Hi @Dylan Maxwell,

The search must first always be executed via our search UI using the searchbar. Clicking on the corresponding search result will take you to the desired content in Confluence.
However, we have not tested "Content Formatting for Confluence" ourselves yet. 

Dylan Maxwell June 29, 2022

Have you tested this with other tabbed content? 

Since confluence pages with tabs don't change url when tabs change, the search functions i've seen just take you to the first or recent tab and can't explore further. 

They can find the search term within the html but can't bring you to that specific tab.

Robby Holtmann_IntraFind Software AG_
Atlassian Partner
August 31, 2022

Hi @Dylan Maxwell

i did a test now "Content Formatting for Confluence" with "iFinder Confluence Search".

All content will be found and displayed with a text snippet in the result list. But click on it, you will get the confluence site with the 1st tab and not to the tab where the result is based. 

0 votes
dellagustin_sap
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 4, 2020

I tried using the Page Tree Search macro.

It does find the content in non-selected tabs, but clicking the result does not select the tab where the content is.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events