I see people creating HTML elements in jQuery in two different ways:
$(\'\')
and
$(\' \')
<
This is what the jQuery docs say about it:
To ensure cross-platform compatibility, the snippet must be well-formed. Tags that can contain other elements should be paired with a closing tag:
Alternatively, jQuery allows XML-like tag syntax (with or without a space before the slash):
Tags that cannot contain elements may be quick-closed or not:
$('
');
$('');
See this question, however, on what is most efficient:
What is the most efficient way to create HTML elements using jQuery?