A function that will loop through span class and add text at the end
<p>I'm trying to do a function, used some pieces of other functions, to loop through the class with a specific name using JS and adding a '*' at the end of whatever is inside those HTML tags. It's not working perfectly, so what do I need to change? The class name is "price".</p>

<pre><code>function insertAfter(referenceNode, newNode) {
    referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling);
}

function getValues(objName) {
    var arr = new Array();
    var el = document.createElement("span");
    el.innerHTML = "*";
    arr = document.getElementsByClassName(objName);
    for(var i = 0; i &lt; arr.length; i++) {
        var obj = document.getElementsByClassName(objName).item(i);
        insertAfter(obj, el)
    }
};

getValues("price");
</code></pre>
