Do you mean something like this http://jsfiddle.net/fJTr8/7/
$('#Submit1').parent('td').css('background-color','red')
$('#Submit1').click(function() {
var module_code = $('#module_code').val()
var module = $("#module").val();
var room = $("#room").val();
var td ="<td class='"+module_code+"'><div>"+module_code+"</div><div>"+module+"</div><div>"+room+"</div></td><td>"
$(this).parent('td').html(td)
});