I’m looking to connect hyperlinks within text elements to events such as onClick() and onMouseIn(). I’ve been perusing the various Wix forums and Stackoverflow, but have been struggling to find anything on this.
I cant find any Element ID associated with hyperlinks within text elements, only Element IDs for text elements themselves.
Any help would be much appreciated.
$w.onReady(()=> {
$w('#text1').html =
`<p>Your text including a </p>`+`<a href="https://www.google.com">MY-LINK</a>`
});
Thanks. Rather than using javascript to generate text and hyperlinks, I was more hoping to connect events to links within the text. Do hyperlinks themselves have identifiers?
I am not aware of the fact, that hyperlinks have own identifiers.
What you could od is to construct/create a function, which would read/scan your whole text for some specific words (which are collected inside an ARRAY for example).
All found words in the text, which also are included in your ARRAY, will be converted into a → HYPERLINK <–.
You could use Reg-Ex for this functionality + match() + replace()
Just an idea.