You need to add the multiple
attribute to the select element, and then you can:
$('#selectall').click(function() {
$('select#studentremain option').attr("selected","selected");
});
$('#deselectall').click(function() {
$('select#studentremain option').removeAttr("selected");
});