I have this jQuery code to add elements in a table row with an \"add\" button:
$(\"#add\").click(function() {
$(\'#selected &g
First of all you have to use classes for your selects instead of an id. jQuery will only return one element when you use an id. After that the following function will convert all values of the selects you give as paramater as an array.
/**
* Convert select to array with values
*/
function serealizeSelects (select)
{
var array = [];
select.each(function(){ array.push($(this).val()) });
return array;
}
So:
var course_ids = serealizeSelects($('.course_id'));
Should for example return:
[1,3,2]