$(function() { // console.profile(); $(":input").hide(); $(".editButton").show(); /*$("tr").dblclick(function() { makeEditable($(this).attr('id')); });*/ $(".editButton").click(function() { var id = $(this).parents('tr').attr('id'); //alert(id); makeEditable(id); $(this).hide(); $("#"+id).find('.viewText').hide(); $("#"+id).find('.saveButton').show(); $("#"+id).find('.cancelButton').show(); return false; }); $(".cancelButton").click(function() { var id = $(this).parents('tr').attr('id'); $(this).hide(); $("#"+id).find('.saveButton').hide(); $("#"+id).find('.editButton').show(); cancelEditable(id); return false; }); $(".saveButton").click(function() { var id = $(this).parents('tr').attr('id'); var serializedForm = $("#"+'form_'+id).serialize(); $.post('/jobs/ajax_edit', serializedForm, function(data) { alert("Posted the Form!!"+data); //Need to do something here to update the Row. }); //console.log($("#"+id).find('form').serialize()); return false; }); $('form').submit(function() { //console.log($(this).serialize()); return false; }); //console.profileEnd(); }); function makeEditable(id) { $("#"+id).find(':input').show(); } function cancelEditable(id) { $("#"+id).find(':input').hide(); $(".editButton").show(); } function getParent() { }