Is it possible to put an onclick event in a sitemap link's anchor tag? Using the format type option in the sitemap just adds formatting within the anchor tag, where i need to add an onclick event to the actual anchor tag.
Onclick event on a sitemap link
Daniel_Nitsche
(Daniel Nitsche)
#2
%asset_name%
works for me in 3.14.1. Is that what you're trying to do?
Geoff
(Geoffrey Bailey)
#3
Yep, thats what I am doing which works, but I still end up with an anchor tag nested inside an anchor tag. I'm guessing there is no way to control the default format of a sitemap link…
Daniel_Nitsche
(Daniel Nitsche)
#4
Ah yes, I see. Just wrap a span around you text instead then; onClick should still be valid.
If the onClick must originate from the [i]a[/i] tag, you could add an event listener to the parent of the span tag (which listens for onClick) using JavaScript.
Geoff
(Geoffrey Bailey)
#5
[quote]Ah yes, I see. Just wrap a span around you text instead then; onClick should still be valid.
If the onClick must originate from the a tag, you could add an event listener to the parent of the span tag (which listens for onClick) using JavaScript.[/quote]
Nah the onclick doesnt work on the span, i tried it earlier. I'll run with the double anchor tags for now and might look at adding the event listener later on. Thanks for you help.
Daniel_Nitsche
(Daniel Nitsche)
#6
No worries :) It does work for me in Camino (Mac). Make sure onClick is capitalised correctly if you're using XHTML.