ianaré
ianaré

Reputation: 3298

Chrome doesn't disable submit button with span

If I have a submit button with a span inside it, it looks like Chrome still allows the span to be clicked when the button is set to disabled.

<form method="post" action="/changestatus" id="yw0">
  <input type="hidden" name="id" value="5">
  <input type="hidden" name="status" value="enabled">
  <button type="submit" disabled="disabled">
    <span>Submit</span>
  </button>
</form>

The preceding code works as expected in Firefox, but not in Chrome.

Any ideas on fixing this (without JS if possible).

Thanks!

Upvotes: 1

Views: 1595

Answers (2)

Gabriele Petrioli
Gabriele Petrioli

Reputation: 195982

For submitting the form it does not submit in either browser (as it should).

If, though, with allows the span to be clicked you mean javascript firing the click event when clicking on it, then indeed there is a difference on how they handle this case.. (you will have to handle it through javascript)

Upvotes: 2

Rick Hoving
Rick Hoving

Reputation: 3575

If you don't want the form to submit you can add this code to your form element.

<form onSubmit="return false;">

I know its a JavaScript fix, but it is one.

Upvotes: 0

Related Questions