I have not been clear enough, sorry. I try again and hope to explain better.
Say you have a repeater with just 1) an image and 2) a text below the image. The image is taken from a database whereas the text is always the same (it is not connected to the DB). The Text contains a link to an email address:
While the repeater works well (all the required images are displayed and the text is correctly shown below each image), the link in the text does not work and in particular the “href” part is missing from the code (see below).
If you want to see the issue, please click on this link:
If I inspect the code generated by wix I find this:
<p class="font_2" style="font-size:14px; line-height:1.7em;">Like this painting? Then send me an email -- <span style="text-decoration:underline;"><a>info@delucaarte.it</a></span></p>
and as you can see the href is missing after the tag.
I think what Tal is saying is that the effect you managed to get using the text version of the link is most likely to do with how the browser renders what it thinks of as a possibly URL. To be sure that youre link works you need to tell the wix code that what you have IS a URL by using the correct wix element mapping. I think you are right in that Tal assumed you were getting the link from the dataset. But her general guidance is still valid.
I think what you need to do is change your string to being an html snippet and assign it to your textbox, something like this ( note this needs to be a Text element not a TextBox as TextBox doesn’t have an html property):
$w("#paintingMessage").html = '<span><b>Like this painting? Then send me an email --</b><a href="mailto:info@delucaarte.it">info@delucaarte.it</a></span>';
Try changing the name of the scope variable in your forEachItem function
$w.onReady(function () {
$w("#dynamicDataset").onReady( () => {
// Use $itemScope not $w for repeater scoped elements
$w('#repeater2').forEachItem( ($itemScope, itemData, index) => {
$itemScope("#paintingMessage").html = '<span><b>Like this painting? Then send me an email --</b><a href="mailto:info@delucaarte.it">info@delucaarte.it</a></span>';
} );
} );
});
Hi Mauro:
I wonder what other page configuration or dataset configuration you have.
I have created a dynamic page similar to yours with the email as described above which works.
You probably need someone to take a look at your page in the Editor. Wix can do that. If you would like me to I can also but you would need to make me a contributor temporarily.
I see that your page works well… I will start from your code and try to find my mistake… you have done already enough and I don’t want you to waste more time with this!
Hope to report soon that I finally have a working page…