Fixed enter button problem with event.preventDefault()