所以我一直收到“对象不支持这个属性或方法”的错误。我可以让菜单滑下来,但当我的鼠标离开菜单时,我不能让它滑上来。(#建议)
下面是我的代码:(jQuery 1.6)
<script type="text/javascript">
function lookup(inputString) {
if(inputString.length == 0) {
// Hide the suggestion box.
$('#suggestions').hide();
} else {
$.post("rpc.php", {queryString: ""+inputString+""}, function(data){
if(data.length >0) {
$('#suggestions').slideDown('slow');
$('#autoSuggestionsList').html(data);
// slideUp on mouseleave
$('#suggestions').mouseleave(function() {
$('#suggestions').slideUp('slow');
});
}
});
}
} // lookup
function fill(thisValue) {
$('#inputString').val(thisValue);
setTimeout("$('#suggestions').hide();", 200);
}
发布于 2011-06-19 03:28:07
您是否将此代码包装在一个现成的处理程序中?
$(function(){
// all your stuff in here so all the elements you select exist before you assign handlers to them
});如果没有,您可能会得到不一致的结果,这取决于您将脚本放在哪里。
编辑实际上,这对你来说并不重要,因为你只是在这里定义函数。
https://stackoverflow.com/questions/6398333
复制相似问题