File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes HTML, CSS and JavaScript and the fly likes edit a cell of a table Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "edit a cell of a table" Watch "edit a cell of a table" New topic

edit a cell of a table

Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
I want to edit a particular cell of a row in a table containing many rows in a Javascript function, i.e I got the table and the row,cell;I have to now make it editable so that the user can modify it.How does one achieve it?
marten kay
Ranch Hand

Joined: Feb 03, 2007
Posts: 178

if it's unformatted text, then you could get the td's text node and delete it from the Dom and replacing it with a textarea that has a value equivalent to that text node, you would then need to reverse the process after the text area has has been edited to the desired value.

If it's formatted text, you may need to use designMode such as RichTextEditingDemo, or use another existing rich text editing JS tool.

when in doubt put it in parenthesis and stick a dollar sign in front of it, only good can come from this.
Pradeep Adibatla
Ranch Hand

Joined: Oct 27, 2009
Posts: 336
Is there something like ,

in java script to edit a row, if 'row' in the above is the row selected??

Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
You need to make the cell hold a textbox or textarea. You can style them to have no border so it will look seamless. ANother option is to look at JavaScript code called "Edit In Place"

I agree. Here's the link:
subject: edit a cell of a table
jQuery in Action, 3rd edition