updates the JS for new jQuery versions (without .live)

.live was deprecated and is now removed in jQuery. Now uses an event handler on the document.