Skip to content Skip to sidebar Skip to footer

Disable Certain Input Element With Javascript Enabled

How do I disable element so it will not submit when clicking on it (but make sure javascript events still work)? 'Disabled' attribute turns javascript off.

Solution 1:

Add return false; to the Javascript event handler. (or e.preventDefault(); e.returnValue = false;)

Solution 2:

Another option is to not make it a submit button

<inputtype="button" value="Button Text" onclick="myHandler()" />

Post a Comment for "Disable Certain Input Element With Javascript Enabled"