Reputation: 1
So i keep getting the error "Object doesn't support this property or method". I can get the menu to slide down but I can't get it to slide up when my mouse leaves the menu. (#suggestions)
Here is my code: (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);
}
Upvotes: 0
Views: 429
Reputation: 9037
Are you wrapping this code in a ready handler?
$(function(){
// all your stuff in here so all the elements you select exist before you assign handlers to them
});
If not, you can get inconsistent results depending on where you put your script.
edit actually, this won't matter in your case because you're only defining functions here.
Upvotes: 1