I am displaying a table using php on an html page. I want to edit the cell contents (basically make changes to a value, and make ajax call to update the database). The requirement for me is to use an onblur function (I can get around with using onkeypress as well). Can anyone please tell me what would be the simplest way of getting the new value entered with the cell id?
The alert for x tells me its "object HTMLTableCellElement"
Thanks!!!
foreach($_RESPONSE['VENDOR_LIST'] as $r){
echo "<tr><td>".$r['fdEmail']."</td><td id='companyname_".$r['fdId']."' contenteditable='true' onblur='updateValue(id)';>".$r['fdCompanyName']." ".$r['fdId']."</td></tr>";
}
Javascript method
function updateValue(thisdata){
alert(""+thisdata);
var x=document.getElementById(""+thisdata);
if(x){
alert(x);
//var r = x.value;
}
else
alert("not found");
}