Hello everybody, so iam Trying to insert an HTML Element into an another HTML Element using Javascript.
I Tried using .insertAdjacentHTML
but it inserts it near to the target element as the positions isn't suitable for me... and .html
inserts it as text format not HTML format
here is what i tried coding:-
SendClientMessage(COLORS_.white, "15px", "none", '<div class="ls-files">' + CMDS_List + '</div>');
function SendClientMessage(color, font, align = 'none', message)
{
if(align !== "none")
{
output_.insertAdjacentHTML('beforeend', '<p style="color: ' + color + '; font-size: ' + font + '; text-align: ' + align + ';">' + message + '</p>');
}
else if(align === "none")
{
output_.insertAdjacentHTML('beforeend', '<p style="color: ' + color + '; font-size: ' + font + ';">' + message + '</p>');
}
}
the output:-
<p style="color: #FFFFFF; font-size: 15px;"></p>
<div class="ls-files">clear,clock,dati,ping,uname,whoami,cmd,</div>