Created
November 22, 2013 18:24
-
-
Save kreamweb/7604568 to your computer and use it in GitHub Desktop.
Wordpress search form + Clear text Field
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form method="get" id="searchform" action="http://www.weedowonka.it/" _lpchecked="1"> | |
<input type="text" value="inserisci il testo da cercare.." name="s" id="s" onfocus="clearText(this)" onblur="clearText(this)"> | |
<input type="submit" id="searchsubmit" value="cerca"> | |
</form> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function clearText(field){ | |
if (field.defaultValue == field.value) field.value = ''; | |
else if (field.value == '') field.value = field.defaultValue; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment