Make sure the JavaScript used document.on()

Make sure it also works with AJAX pages. Fixes #8.