This code generates a comma separated string to provide a list of ids to the query string of another page, but there is an extra comma at the end of the string. How can I re
Use Array.join
Array.join
var s = ""; n.each(function() { s += $(this).val() + ","; });
becomes:
var a = []; n.each(function() { a.push($(this).val()); }); var s = a.join(', ');