I have a function that returns the currently focused item’s ID and a random string. I use a different function to parse through that string.
I need to also return the aria-label, which is where I’m having trouble. None of my current attempts have worked.
Button:
<button class="some-class" id="some-id" aria-label="some-label" onfocus="reply_focus(this.id)">Button Text</button>
Javascript:
var global_focused_id = -1;
function GetLastFocusedId() {
return global_focused_id;
}
function reply_focus(focused_id) {
global_focused_id = focused_id + ' || ' + Math.random();
}
What returns now is:
“some-id || 0.1234567890“
What I’d like returned is:
“some-id || some-label || 0.1234567890“