JS fix (forgot to make document a jQuery object)