javascript - Make a table cell editable by placing input box over td -


i want make table cell editable on double click can put value in cell :

enter image description here

currently placing input box inside td on dblclick on :

$('<input type="text" />').val(oldcellval).appendto($this).end().focus().select(); 

$this td element in want show input box on double click, on blur removing input box , setting new value back.

i show input box over td element instead of inside appear input inside td element, because using table library allows text inside td elements, on adding html element(input) inside td not working properly. appreciated. thanks.

for similar result can use contenteditable

<table border="3"> <thead> <tr>heading 1</tr> <tr>heading 2</tr> </thead> <tbody> <tr> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> <tr> <td contenteditable='true'></td> <td contenteditable='true'></td> </tr> </tbody> </table> 

fiddle:https://jsfiddle.net/kpkjr7ev/


Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -