Skip to content

Instantly share code, notes, and snippets.

@meandavejustice
Created December 6, 2012 19:39
Show Gist options
  • Save meandavejustice/4227623 to your computer and use it in GitHub Desktop.
Save meandavejustice/4227623 to your computer and use it in GitHub Desktop.
.blur is catching .js-search-clear before it gets to $document
$document.on('click', '.js-search-close', function(e) {
e.preventDefault();
$('#navigation-global-search, #datepicker').val(''); // clear form value
Backbone.history.navigate(lastFragmentBeforeSearch || '', {trigger: true});
});
$document.on('click', 'js-search-clear', function(e) {
e.preventDefault();
$('#navigation-global-search').val(''); //clear form value
});
$('#navigation-global-search').focus(function() {
$('.js-search-clear').show();//make close appear on focus
});
$('#navigation-global-search').blur(function() {
$('.js-search-clear').hide();//and disappear
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment