Is there a way to insert a div inside another div using jQuery?
Here is the main div:
<div id ="username_error"></div>
And here is the div that should be placed inside it:
<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
I attempted this code snippet:
$("#username_error").html('<div class="alert alert-primary" role="alert">
This is a primary alert—check it out!
</div>
');
Unfortunately, this method did not work. Is there an alternative approach you can suggest? Thank you in advance.