div {
border: 3px solid black;
}
span {
border: 2px solid blue;
}
<div contenteditable>
<span contenteditable id="haha"><i>asd</i></span>
</div>
I want to focus on #haha, but it only works if I move the element outside the div
div {
border: 3px solid black;
}
span {
border: 2px solid blue;
}
<div contenteditable>
</div>
<span contenteditable id="haha"><i>asd</i></span>
Currently using this this code for the focus, if there a way to focus on the span element even if it's inside the div?
document.querySelector(`#haha`).focus();