Take all of the items and concatenate them into an input.
There is a better way.
item1
item2
item3
var myString = ""; $("#container .item").each(function(i){ myString = myString + "," + this.id; }); $("#myInput").val(myString);