Heading navigation

Hello! I’m new to bubble and ran into a problem.
I have a text in the database and it has headings tagged [h2][/h2]


I need to get these headings separately from the text and put them in text elements on the page and then navigate when they are clicked.
I am using this code.

const db = await BubbleSDK.data.getApi();
const records = await db.search(‘content’);
const contentStrings = records.map((record) => {
return record.content;
const headings = ;
const regex = /[h2](.*?)[/h2]/g;
for (let i = 0; i < contentStrings.length; i++) {
let match;
while ((match = regex.exec(contentStrings[i]))) {
const myTextElement = await BubbleSDK.element.getElement(‘idid’);

But it doesn’t work.
If you know how to do this, please help me. Thank you!

It looks like you are following gpt allucinations (good luck with that) or you are using a private library (you should check the relative documentation).
If you have a look at the bubble docs you can find both how to create plugins and how to use the data api to query the database.

I did use gpt for help. Am I querying the database incorrectly? Do you mean it?

This topic was automatically closed after 70 days. New replies are no longer allowed.