In jquery what does $('<div></div>') do?
I was implementing a jqueryui modal dialog box and a related blog showed a way of implementing it that worked but I don't understand what $("<div></div>") is actually doing. Is this creating a blank div element to use? Is this a safe way of implementing this?
It's equivalent to document.createElement('DIV').
You can look at the jQuery source. Look for the comment:
// Handle HTML strings
And you'll see how it works.
The <div> created is empty, has no attributes, and is not attached to the DOM.
It's more common to see it written as:
...but not functionally different.
Often it's chained with a method like appendTo(), to insert it into the DOM.