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


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.


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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,


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Westside2004Author Commented:

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

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?

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.