Creativity is allowing yourself to make mistakes. Design is knowing which ones to keep.

Scott Adams

JQuery – Closing Tags in DOM Element Creation

December 28th, 2013

In most modern browsers this pattern:


works fine and places a form element on the page inside the $rootElement. In IE8 (and I’m guessing earlier) however this pattern is required:


The second pattern is probably the correct way to form a new element in a jQuery .append() but if you are used to getting away with the former then it may bamboozle you a bit when it fails inIE.

Neither of these is ideal however as this pattern:


is faster (DOM object creation on jsperf).

Web Design|IE Gotchas