preventdefault purpose form javascript code example Example: event preventdefault event.preventDefault()