Reputation: 3
I have put an onClick()
event in which I call a function to get the value of any element clicked inside the HTML body and display it inside a web component.
<div id="root" onclick="traiteClick(event)"></div>
This is how I get the clicked object inside the traiteClick()
function.
let object = document.getElementById(evt.target.id).innerHTML;
This works with HTML elements since I can give them ids but not with my ui material elements.
<ListItemText className='test' primary="Date de naissance" secondary={artist?.lifeSpan?.begin} />
I tied using getElementsByClassName
but it didn't work.
Do you have any suggestions?
Upvotes: 0
Views: 78