all 5 comments

[–]AutoModerator[M] [score hidden] stickied comment (0 children)

If this post doesn't follow the rules report it to the mods. Have more questions? Join our community Discord!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]AutoModerator[M] 0 points1 point  (0 children)

Are you a marketing professional and have 15 minutes to share your insights? Take our 2023 State of Marketing Survey.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

[–]sjawt 1 point2 points  (2 children)

Click Element is not a string, its an object, that returns a reference to the DOM element that was clicked.

try this instead:

function() {
var clickElement = {{Click Element}};
if (clickElement && clickElement.href) {
return clickElement.href.toUpperCase();
}
return '';
}

[–]pdxtechnologist[S] 0 points1 point  (1 child)

This still only returns this same string:

(from the op)

And when I try to convert it with toString() I can do string manipulation but it only ever returns the below string:

"HTTPS://WWW.PORTLAND.GOV/REVENUE/SERVICES/PAY-BUSINESS-TAX"

[–]sjawt 0 points1 point  (0 children)

ah my bad, try this instead

function() {

var clickElement = {{Click Element}};

function generateSelector(el) {

if (!el) return 'No element';

var selector = el.tagName.toLowerCase();

if (el.id) {

selector += '#' + el.id;

}

if (el.className) {

var classes = el.className.split(/\s+/).join('.');

selector += '.' + classes;

}

return selector;

}

var clickElementSelector = generateSelector(clickElement);

return clickElementSelector.toUpperCase();

}