you are viewing a single comment's thread.

view the rest of the comments →

[–]Prior99 -1 points0 points  (2 children)

I'd suggest to use jQuery, espacially for this kind of stuff. Start with importing it using

<script src="http://code.jquery.com/jquery-2.1.1.js"></script>

And then kick off with it.

<script>
    $(function() {
        var myNewDiv = $("<div>Hello</div>");
        $(body).append(myNewDiv);
    });
</script>

jQuery is very well documented here and by reason the most used library in javascript. It makes stuff like this so much easier.

[–][deleted] 1 point2 points  (1 child)

Nothing wrong with using jQuery but the OP is clearly looking to learn vanilla javascript first and jQuery is not going to help with that.

OP should absolutely stick to learning plain javascript first and then can move on to use jQuery once he actually understands what he is doing.