When I need to create elements in the DOM using jQuery, I usually use the following syntax:
$('<div>').addClass('minha-div').attr({id: 'id-da-div'});
However, what I usually see in online tutorials is a bit different. Usually it is:
$('<div></div>').addClass('minha-div').attr({id: 'id-da-div'});
Or:
$('<div id="id-da-div" class="minha-div"></div>');