ul will display when input field gets some input. Now I want to hide ul when both input and ul loses focus. Same as the stackoverflow search bar works. I tried some options but didn't work. I am sure I'm not applying appropriate method for this .I want to know the functionality for this so, kindly give your solution in javascript not jquery.
document.getElementById("1").addEventListener("blur", function(){
document.getElementById("2").addEventListener("blur", function(){
document.getElementById("2").style.display = 'none'
})
})
<input type="text" id="one">
<ul id="two" style="display: none;">
<li>ajbf</li>
</ul>
ulelement when you have aninputelement active?