I am trying to achieve a scenario where the focus of a div is on an input field when clicking on it, rather than focusing on the div itself. The issue I am facing is that clicking on the span element inside the div causes the div to be focused instead of the input field. How can I make sure that the input field loses focus and then the div gets focused when the input field is clicked?
Below is the code snippet:
.img {
background: #ef1111;
}
<div tabindex='0'>
<input type='text'/>
<span class='img'>Try me !</span>
</div>