How do I create a div
element in jQuery?
As of jQuery 1.4 you can pass attributes to a self-closed element like so:
jQuery('<div/>', {
id: 'some-id',
"class": 'some-class',
title: 'now this div has a title!'
}).appendTo('#mySelector');
Here it is in the Docs
Examples can be found at jQuery 1.4 Released: The 15 New Features you Must Know .