-
Create elements dynamically along with attributes using
document.createElement
document.createElement('<div id="wrapper" class="global">')
This will create a
div
with the attributesid
andclass
set. So the resulting element's html would look like,<div id=wrapper class=global></div>
IE Versions 6, 7, 8
Resources : MSDN createElement method
-
The
name
attribute cannot be set on a dynamically created element in run-time. So to create an element with the name attribute set, create the element with the attribute set usingdocument.createElement
var textField = document.createElement('input'); textField.setAttribute('name', 'first-name'); //will not work in IE
Instead use the following,
var textField = document.createElement('<input type="text" name="first-name" />');
IE Versions 6, 7
Resources : MSDN name property, Setting the 'name ' attribute in IE
-
Background image doesn't appear for a HTML 5 element without setting the background color
IE Versions 7
-
min-height
is ignored when box sizing is set asborder-box
.Firefox 10