I have a nested li which is editable. How can I get the particular li when there is 'keyup' event happened on that li. No jQuery please.
I tried to put eventlistener 'keyup' on all li but e.target is giving most outermost li (li#1) instead of (li#4). when I tested with 'click' event it is giving the exact li(li#4) being keyed up.
var numberList = document.querySelector("#numberList");
numberList.addEventListener('keyup', handler)
function handler(e){
if(e.type === 'keyup'){
getId(e)
}
}
<ul id = "numberList">
<li id="1">
one
<ul>
<li id="2">
two
<ul>
<li id="4">four</li>
</ul>
</li>
<li id="3">three</li>
</ul>
<li id = "5">
Five
<ul>
<li id="6">six</li>
</ul>
</li>
If I edit li having value "four", I should get li with id ="4" not id="1"