We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now


Making a <td> editable using css.  Help needed if possible.

Westside2004 asked
Medium Priority
Last Modified: 2006-11-18

I am trying to make this html table editable.  I have a query that generates any number of rows with values liek

First Name  | Last Name | Email  |  edit icon

When the user clicks the graphical edit icon, I want the given row they are trying to edit, to change the firstname, lastname, and email fields into input boxes so the user can change the values.  The edit icon at that point should change to a save icon basically another graphic that looks like a 'save icon'

How can I do this?

So essentially the values in the above 3 columns are just in <td's>, but when you click the edit icon, it should go from just text as "John" to an input field with the value "John" so the user can then change it.

Hope that makes sense.


Watch Question

Top Expert 2006
You could have
<tbody class="uneditable" id="myTbody">
     <td><a class="whenUnEditable" href="#edit" onclick="document.getElementById('myTbody').className='editable';return false;">Edit</a>
     <td><span class="whenUnEditable">Joe</span>
         <input type="text" class="whenEditable" value="Joe" />

Then have this css:

.uneditable .whenEditable {display:none;}
.editable .whenUnEditable {display:none;}

Hope this helps, and makes sense,


Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts



This does not seem to work in firefox...maybe I should have mentioned that

Top Expert 2006

I doubt is doesn't work in firefox, because I have the same script using collapses/uncollapsed working fine.

In firefox, what does the Javascript console from the tools menu say?

Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.