Updated to work on jQuery 1.9+ and tested on 2.1.1