In that case, perhaps we should just say that all of
the options are fine:
$( '<div>' )
$( '<div/>' )
$( '<div></div>' )
but emphasize not to use attributes in the tag creation.
+1
All three will return the same, and this is not HTML, it's JavaScript. It
really is just a matter of personal flavor in coding style, nothing else.
By the way, you can also use
$( '<div/>', { 'class': 'foo', 'title':
'myTitle', ... } );
for adding attributes right away. Should be faster, more readable and less
error-prone than using tags directly in the div's definition string.
Cheers,
Daniel W