A. When we select multiple items which are comma separated then there is last comma also appear.
Ex:
Value1, Value2, Value3,
But we don’t want last comma to be present there. According to need we have to remove last comma from the string.
Solution:
str= str.replace(/,\s*$/,””);
in this in palce of str we can place our own value
var str= Value1, Value2, Value3,
str1= str.replace(/,\s*$/,””);
alert(str1);