Make tags from text and textarea fields content with javascript-Collection of common programming errors

While you’ve already accepted an answer, I’d like to suggest this alternative:

function updateValue(els, output){
    // creates an empty array
    var textArray = [];

    /* iterates through the `els` array and if the value is not
       an empty string, splits the value at the white-spaces
       and pushes the array of values to the `textArray` */
    for (var i=0,len=els.length; i