How to link JS to image in header Xpro

I use XPro I’m trying to add an affiliate link to an image in the header, however unsure of correct course of action.

I have added a bar and inserted an image. I need to add code to the image.
I have 4 different version but thought I would start with the JS, I have added the code, but how do I connect it to the image itself?

Thanks in advance

Hi there,

This is a customization request which is outside the scope of our support and we will not be able to implement the functionality. But we can guide you to do it yourself.

Kindly add an ID name to the Image element by clicking on the Customize tab:

Now you can add the Javascript code below to Pro > Launch > Theme Options > JS:

jQuery('#affiliatelink').on('click', function() {
	window.location = "LINK TO YOUR AFFILIATE WEBSITE";
});

Change the LINK TO YOUR AFFILIATE WEBSITE according to your needs.

As you can see in the JS code we selected the ID which you have added in the image element customize tab.

Hope it helps.