Open external links in a new tab

Hello, please can you help me how to open external links in a new tab without my links opening in a new tab. I used the code below i found on similar topic to this, however i didn’t like my links opening in a new tab. To be more precise I put links on companies’ logos. I would like those to open in a new window.

Greetings, Andre

Please share the code you used here.

If possible, share a link to your site here so can inspect what goes wrong.

Regards,
Kharis

46

Did you mean clients’ logos?

Like this section seen on our demo?

https://demo.athemes.com/sydney/

Regards,
Kharis

Yes, that’s it.

Kind regards,
Andrej

Hello Andrej,

Try the below steps:

  1. Install and activate the TC Custom JavaScript plugin
  2. Go To Appearance > Custom JavaScript
  3. Paste the following code into the provided box
    (function($){

      if( $('.elementor-widget-image-gallery a').length ) {
        $('.elementor-widget-image-gallery a').attr('target', '_blank');
      }

    })(jQuery);
  1. Update

If it doesn’t work, please share a link to your site to help me get the exact selector to use.

Regards,
Kharis

Hi Kharis,

Unfortunately it doesn’t work.
My site is under construction right of now. Does it help if I share with you “view-source” screenshots of the part I would like to open in a new tab?

Greetings,
Andrej

Hello Andrej,

Based on your screenshots, they indicate that you’re using Site Origin’s page builder. In the client widget’s settings, there’s an option that reads “Open clients links in a new tab?”. Have you enabled it?

Regards,
Kharis

Dear Kharis,

You guys are awesome with the work you do! Yes, now it works. I realised I was using the wrong widget. Thank you for helping me!

Greetings,
Andrej

You’re welcome!

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis