Update jquery code for compatibility with 1.9