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

x

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

Westside2004
Westside2004 asked
on
Medium Priority
254 Views
Last Modified: 2006-11-18
Hi,

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.

Thanks

-ws
Comment
Watch Question

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

Then have this css:

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

Hope this helps, and makes sense,

-r-

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

Ask the Experts

Author

Commented:
Hi,

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

-ws
CERTIFIED EXPERT
Top Expert 2006

Commented:
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?

-r-
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.

OR

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.