How do I create a div
element in jQuery?
You can use append
(to add at last position of parent) or prepend
(to add at fist position of parent):
$('#parent').append('<div>hello</div>');
// or
$('<div>hello</div>').appendTo('#parent');
Alternatively, you can use the .html()
or .add()
as mentioned in a different answer.