I am trying to define a global jquery object variable so that I can access it from different functions.
This is what I am doing:
var object_list = $("#object_list");
var list_length = object_list.find("li").length;
$(document).on('keydown', '#object_list', function(event) {
//both of these don't work
alert(object_list);
alert(list_length);
});
Well,, for some reason this is not working (the first alert gives me NULL and the second gives me 0, which is not).
Why aren't my global variables working..??
Thanks!!
#object__listand#object_list? Hmmmmmobject_listwould equalthisinside the event handler, so it doesn't make much sense ?