Browsers bail on DOM button.type="button"

Atom RSS

This site heavily relies on bug reports created by its readers. Anyone can report a bug and be published.

Main navigation:




Search reports by browser:

The following will throw an exception:

var button=document.createElement("button"); button.type="button";

The only workaround for dynamically creating <button type="button"> seems to be to convert the button HTML to a string and append it to innerHTML.

Test page Workaround is included
Reported by: Garret Wilson.

Explorer 5-6 Windows, Explorer 7 beta 2, Explorer Mac, Opera | Reported on 10 October 2005.

Comments

(Add your own)

Posted by Alu Jones on 11 October 2005

1

Use:
button.setAttribute('type', 'button');

Post a comment

Commenting guidelines:

  1. When quoting specs, articles or your own research, please include a URL of the document.
  2. Test your stuff. When reporting browser behaviour, make sure that your report is correct.

Yes