How do i split into a block of 3?

I want to separate a set of 3 numbers with a comma and set the value to a textarea, i have tried this but it just brings the values concatenated like this "5.685.685.85", i want it to appear like this "5.68, 5.68, 5.85"

var once = window['tma'+kj].toFixed(2);
for (var li=0; li<once.length; ++li) {
    $('#comments').append(once[li]); //div tag, it shows concateneted
    $('#com').val(once[li]); //textarea id, brings blank
}

Answers


var once = window['tma'+kj];
var arr = [];
for (var li=0; li<once.length; ++li) {
    $('#comments').append(once[li]); //div tag, it shows concateneted
    arr.push(once[li].toFixed(2)); //textarea id, brings blank
}
$('#com').val(arr.join(','));

Assuming that once is an array:

$('#comments').val(once.join (', '))

Need Your Help

Java UNIXProcess not visible in Eclipse?

java constructor mocking visibility

I tried to use the UNIXProcess.class, but the eclipse keeps warning me that UNIXProcess is not visible.

pip, proxy authentication and “Not supported proxy scheme”

python pip urllib pypi urllib3

Trying to install pip on a new python installation. I am stuck with proxy errors. Looks like a bug in get-pip or urllib3??

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.