Make preventDefault work the first time