dimanche 5 mars 2017

Remove two chars

I can't remove two symbols in js array.

var specString = '${s}';
var specialists = specString.split(',');
for(i = 0; i < specialists.length; i++){
    var option = document.createElement("option");
    option.value = specialists[i];
    option.text = specialists[i];
    category.appendChild(option);
}

specString = [A,B,C];

And when i adding option value, specialist[0] = '[A', next row 'B' and last'C]' Me need just 'A' and 'C', without these '[]' symbols. I tried all js methods substr(0;-1), substr(0;specString.length-1), slice and others.

Help pls. Thx

p.s. '${s}' -> this List<String> from requestScope




Aucun commentaire:

Enregistrer un commentaire