Hi, I'm doing the site search bar and the bar template and so: it has an image of a magnifying glass and when you click on the image, under it appears the input to type the search. I'm doing this in JavaScript but I'm having problems. It happens so when I click the input appears more when I click outside it is still there, how can I make it disappear I tried to use if and else, for loops more I did not get anything. Can anybody help me? Thanks!
<script>
function mostrarPesquisa(){
document.getElementById('pesquisa').style.display="inline-block";
}
</scripit>
<div id="menu">
<div id="dentromenu">
<ul class="menu">
<li class="activeItem"><a><img class="lupa" src="imagens/lupa.png" alt="Lupa" onClick="mostrarPesquisa()"></a>
<div id="caixapesquisa">
<form id="formpesquisa" action="" method="get">
<input id="pesquisa" class="pesquisa" type="text" value="" maxlength="" placeholder="Pesquisar..."><input id="btnpesquisa" type="hidden" src="imagens/lupa.png" value="">
</form>
</div>
</li>