How to add a cut string in the list with javascript? : <p>I have a small problem with the JavaScript. I would like to add the string (format:one-two-three) the list, but this cut the sign ("-") and every elements tag add. I try solve this problem, unfortunatelly don't succeeded. Here my function:</p>

<p>function listAdd(){</p>

<pre><code>var string = document.forms["form1"].elements["stringAdd"].value;
if(string != ""){
    var array = string.split("");
    var eredmeny = array.some(function(v) { return v == "-";});
    if(eredmeny){
        for(var i = 0; i &lt;array.length; i++){
            if(array[i] != "-"){
                var newElement = document.createElement('li');
            array[i] = array.toString();
            newElement.textContent = array[i];

            var list = document.getElementById("gyumi");
            list.appendChild(list.createTextNode(array[i]));
            }
        }
    }
    else{
        var newElement = document.createElement('li');
        newElement.textContent = szoveg;

        var list = document.getElementById("gyumi");
        list.appendChild(newElement); 
        }



    }
</code></pre>

<p>}</p>

<p>Sorry, poor my English and this is the first question to me.</p>
