I have this html code:
<div id="wordListDiv">
<ul>
<li id="word_0">bateau</li>
<li id="word_1">braguette</li>
<li id="word_2">bateau</li>
</ul>
</div>
Then I have a javascript file:
document.addEventListener( 'click', mouseEventsListener);
function mouseEventsListener ( event ) {
switch( event.target ) {
case ***HOW_TO_DETECT_CLICK_ON_THE_LI_ELEMENTS***:
myFunction( parameter );
break;
default:
break;
}
}
How can I execute myFunction from within the switch/case statement when the user clicks on a "li" element?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…