'when clicked outside the dropdown menu then top default value of the search need to take

how to set After searching from a search bar if it is clicked outside the search bar then it should take the first value of my search ?? I have tried with addEventListener() and prop() method but is there any alternative



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source