How to append text to a specific <div>
if i know the ID of the <div>
?
For example, here's my code:
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
function appendDIV(idDIV, txt) {
$("#" + idDIV).append('<p>' + txt + '</p>');
}
appendDIV("content-01", "some text");
</script>
<div id="content-01" style="float: left; width: 150px; height: 150px; border: 2px solid red;"></div>
Function accepts the ID of the <div>
and some text, but nothing happens.
What's going wrong?
element inside specific div. How to do that?
– Josef Jun 15 '18 at 18:17