Created
August 17, 2012 22:25
-
-
Save thecodedrift/3383252 to your computer and use it in GitHub Desktop.
document.createElement, Checkboxes, and IE
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var cb = document.createElement("input"); | |
| cb.type = "checkbox"; | |
| cb.checked = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // IE requires a checkbox to be made differently | |
| try { | |
| var cb = document.createElement("<input type=\"checkbox\" checked>"); | |
| } | |
| catch (e) { | |
| var cb = document.createElement("input"); | |
| cb.type = "checkbox"; | |
| cb.checked = true; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment