Help needed with appending a hidden div
with its styles intact. Despite using the code provided below, the appended div does not retain its styles. Any suggestions for an alternative method?
var warningMessage = $('#warningDiv').html()
function postSettings() {
var frm_data = $("#MyForm").serialize();
$.ajax(
{
type: "POST",
url: "path",
data: frm_data,
success: function (successData) {
var warningMessage = $('#warningDiv').html();
**$(warningMessage).insertAfter("#MyDiv"); // The warning message is not displayed with proper css styling.**
},
});
}
Even though the above approach successfully appends the HTML content, the desired styles are missing. To achieve this, the following hidden div needs to be dynamically appended along with its styles:
<div class="note note-warning" id="warningDiv" style="display:none">
<div class="block-warning">
<h4 class="block"> <i class="demo-icon icon-attention-1 fa"></i> Warning! Some Header Goes Here</h4>
<p> test</p>
</div>
</div>