我想結合JS功能,但這不起作用。有人對我的代碼有建議嗎?結合JS功能mouseup
$(document).ready(function(){
$(".searchs").keyup(function() {
var searchbox = $(this).val();
var dataString = 'searchword='+ searchbox;
if(searchbox=='') {
$("#display").hide();
} else {
$.ajax({
type: "POST",
url: "searchs.php",
data: dataString,
cache: false,
success: function(html) {
$("#display").html(html).show();
}
});
}
return false;
});
$(".searchs").focus(function(){
var seachbox = $(searchbox).val();
if(seachbox != '') {
$("#display").show();
}
});
});
$(document).mouseup(function(e) {
if ($("#display").is(":visible") && $(e.target).parents$("#display").length == 0) {
$("#display").hide();
}
});
僅供參考,我得到的腳本http://jsfiddle.net/bqQqN/15/。我想要做的是將mouseup函數添加到我的代碼中。任何人?
您通過7個問題建立這樣的。現在,我想知道你真的試過了什麼 – Alexander
正如我所看到的那樣*它代表你的代碼。你想做什麼? – i100