Fednilschiele
New Member
I have a very simple table structure\[code\]<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>\[/code\]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.\[code\]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();\[/code\]Please see JS FIDDLE HERE