I am trying to achieve edit/update functionality on a table.
/************************************************/
tabData = jQuery.makeArray($("#" + RowID));
alert(tabData[0].innerHTML);
//Change the current row's cell to textbox
ChangeTableCellToTextbox(RowID);
alert(tabData[0].innerHTML);
/************************************************/
1st alert shows all row elements
when user hits edit, ChangeTableCellToTextbox(RowID) replace table cells with text input.
but when user hits cancel, I want original table cells..
I am not sure why 2nd alert shows the table with input elements??
ChangeTableCellToTextbox(RowID) does not change the array tabData..
here is the function..
function ChangeTableCellToTextbox(RowID) {
$("#" + RowID + "> TD").filter(function() {
if ($(this).find("INPUT").html() == null) {
return true;
}
}).each(function() {
var TDvalue = $(this).html().trim();
var replacevalue = "<input type='text' title='Enter new value' value=\"" + TDvalue + "\"></input>";
$(this).html(replacevalue);
//Put the focus on the input element
$(this).find("input").focus();
});
//Adjust row fields visibility
rowFieldsVisibility(RowID, true);
}
thanks in advance for the help ..