点击输入时我不想隐藏。 http://jsfiddle.net/bTHNh/1/
$("body").click(function() {
$(".search-input").hide();
});
$("#search").click(function () {
$(".search-input").toggle();
event.stopPropagation();
});
答案 0 :(得分:0)
$(document).click(function (event) {
//alert(event.target.className);
if(event.target.className != 'search-input') {
$(".search-input").hide();
}
});
$("#search").click(function (event) {
event.stopPropagation();
$(".search-input").toggle();
});