search select value from text
$('#search').focus(function(){
$('ul.search-menu').fadeIn();
});
$('.search-menu h5').click(function(){
$('#search').val($(this).text());
$('.search-menu').fadeOut();
});
$(document).mousedown(function (e){
var container = $(".search-menu, .search-megamenu");
if (!container.is(e.target) // if the target of the click isn't the container...
&& container.has(e.target).length === 0) // ... nor a descendant of the container
{
container.hide();
}
});
Comments
Post a Comment