Skip to content

Instantly share code, notes, and snippets.

@Ollo
Created June 11, 2012 21:40
Show Gist options
  • Save Ollo/2912912 to your computer and use it in GitHub Desktop.
Save Ollo/2912912 to your computer and use it in GitHub Desktop.
wordpress jquery search field behavior
// search box behavior text behavior
$('.searchField').focus(function(){
$('#searchsubmit,.searchWrapper').addClass('active');
$('.searchField').val('');
});
$('.searchField').blur(function(){
$('#searchsubmit,.searchWrapper').removeClass('active');
if($('.searchField').val() == '')
$('.searchField').val('Search...');
});
$('#searchform').submit(function(e){
if ($('.searchField').val() == 'Search...') {
e.preventDefault();
} else {
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment