fixed dropdown functionality for jquery 1.9
merging code from andrew hubble's repository for fixing jquery 1.9 issues