I want to create HTML like this
<div id="positional">
<div>
<div>
<label for='azimuth'>Azimuth</label>
</div>
<div>
<input id='azimuth'>
</div>
</div>
</div>
I was trying to use this, but I can't get it to work, can you help?
$("<div><input id='azimuth'></div>")
.insertAfter("<div><label for='azimuth'>Azimuth</label></div>")
.wrap("<div></div>")
.appendTo("#positional");
Assume <div id="Positional"> has already been created. Thanks, I'm pulling my hair out.
EDIT: I know I could just hand insert the HTML in one unreadable blob, but I'm trying to do it step by step and understand the problem. In this the div containing the label doesn't appear.
EDIT2: Seriously, if anyone could explain why this doesn't work, I would be very grateful.
html()?$('#positional').html("<div><div><label for='azimuth'>Azimuth</label></div><div><input id='azimuth'></div></div>')$("#positional").append("<div><div><label for='azimuth'>Azimuth</label></div><div><input id='azimuth'></div></div>");Demo