Add JavaScript variable to HTML [duplicate]

You could create a <span> element and then use jQuery selector to set the html of that element.

Here is an example:

<div class = "box"><span class="span"></span>user</div>
    <script type="text\javascript">
        $(".box .span").html("Hello ");
    </script>

Leave a Comment