I have a very simple table structure
<table width='50%' id='tabs'>
<tr><td>1</td><td>5</td><td>6</td></tr>
<tr><td>2</td><td>2</td><td>2</td></tr>
<tr><td>3</td><td>2</td><td>2</td></tr>
</table>
and here is my simple script to make table editable this is working fine but i found that it is slow and code is not efficient.I would like to improve this code.By the way i am working with jquery 1.3.2
var z={};
function tdClicks(){
var x="",y="";
$("table tr td").click(function(){
z=$(this);
x = $(this).text() || $(this).find("input[type='text']").val();
if(!x){
x="";
}
$(this).html("<input type='text' size='5' value='"+ x+"' />");
$(this).unbind("click");
$(this).find("input[type='text']").bind("blur", function(){
catchme($(this).val());
tdClicks();
});
});
}
function catchme(wht){
$(z).text(wht);
}
tdClicks();
Please see JS FIDDLE HERE