My search form uses a "tip" on the text box, which when onfocus it clear the text box and on blur it shows the "tip".
<script type="text/javascript">
function checkform(form)
{
if (search.s.value == "Pesquisar...") || (search.s.value == "") {
var term = prompt("Enter a value:");
if (term) { search.s.value = term; }
else { return false; }
}
}
</script>
<form id="search" method="get" action="[@siteurl]/search.php" onsubmit="return checkform(this);" >
<fieldset>
<input type="text" name="s" value="Pesquisar..." onfocus="if(this.value=='Pesquisar...') { this.value=''; }" onblur="if(this.value=='') { this.value='Pesquisar...'; }" />
<input type="submit" id="searchsubmit" value="Go!" />
</fieldset>
</form>
This is not working. It is searching the tip text instead of the prompt.
What’s wrong?
check this demo