When user clicks the link, the input text shows. But how can I hide the input text when user clicks anywhere in the page (no need to click the link again to hide it)?
Here is my code
function showOrHide(zap) {
if (document.getElementById) {
var abra = document.getElementById(zap).style;
if (abra.display == "block") {
abra.display = "none";
} else {
abra.display = "block";
}
return false;
} else {
return true;
}
}
using
<a href="#" onclick="return showOrHide('menulink');">click to show or hide menu</a>
<ul id="menulink">
<li><input type="text" /></li>
</ul>