Open link in new tab from database rich text

Hi!

I have tried to find answer for this within Wix Support Center, but without luck, so maybe some code would be the answer.

I have database, and one filed is Rich Text. That field is connected to text element on dynamic page. In my text I have some links and when clicked they are opened in the same tab and I woul like for external links to be opened in the new tab (blank).

Does someone have solution for this?

Page in question is: https://www.gxp-synapse.com/gxp-blog/donosimo-odgovore-na-%C4%8Desta-pitanja-vezano-za-gmp-u-laboratoriju-kontrole-kvalitete

Thank you for your help!

I’ll assume you connected the datasets to the text through the editor. Then you can try:

$w.onReady(() => {
 $w('#dynamicDataset1').onReady(() => {
  $w('#richText1').html= $w('#richText1').html.split('<a').join('<a target="_blank" ');
 })
})

This worked like a charm! Thank you very much for your help!