milo3169
Programmer
- May 2, 2007
- 42
Hi All,
I have this function where you can select multiple selections from a Listbox and it will copy those selections into a text area box.
What I want to do if this is possible is to be able to automatically remove the last "\n" from the text area list before I submit the form. Is there a way I can do that? If so, how? I've been going nuts trying to figure this out. Anyone’s help would be appreciated.
I have this function where you can select multiple selections from a Listbox and it will copy those selections into a text area box.
Code:
function duplicateValue()
{
var main = document.getElementById('main');
var duplicate = document.getElementById('duplicate');
for(var i = 0; i < main.options.length; i++)
{
if(main.options[i].selected)
{
var item = main.options[i].value;
main.options[i] = null;
duplicate.value += item + "\n";
}
}
}
What I want to do if this is possible is to be able to automatically remove the last "\n" from the text area list before I submit the form. Is there a way I can do that? If so, how? I've been going nuts trying to figure this out. Anyone’s help would be appreciated.