Updated JavaScript to use jQuery for selectors and event bindings.