Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 946023
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T22:50:57+00:00 2026-05-15T22:50:57+00:00

I have a table in HTML. I have made this table as editable by

  • 0

I have a table in HTML. I have made this table as editable by using JavaScript. When the user clicks a cell, it will become editable. The problem here is, when the cell is already editable, if the user again clicks on the cell …., some tags and other things appear. i.e. new text boxes appear for every click.

How this could be prevented?

I am using the following JavaScript code:

function changeContent(tablecell)
{
    //alert(tablecell.firstChild.nodeValue);
    tablecell.innerHTML = "<INPUT type=text size=\"6\" name=newname onBlur=\"javascript:submitNewName(this);\" value=\""+tablecell.innerHTML+"\">";
    tablecell.firstChild.focus();
}
function submitNewName(textfield)
{
    //alert(textfield.value);
    textfield.parentNode.innerHTML= textfield.value;
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T22:50:58+00:00Added an answer on May 15, 2026 at 10:50 pm

    If new text boxes are appearing after every click, your code is not taking care of the case: if the cell has an input text box already, then don’t continue entering additional HTML for the input text box when the user clicks on the cell.

    One way to prevent this could be setting the class of the table cell to a class name like “editable” at the end of your changeContent function. Then you can have code in the same function that will only put in the HTML for the input text box if the tablecell.className is not “editable”.

    Remember in your submitNewName function, to also remove the “editable” class name for the cell after the user is done editing.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have made this nice little table: testPage.cfm: <html> <head> <title>Test Page</title> <style> .blue{
I have a table in HTML which has three columns i.e Error - User
see fiddle i have html table and one textbox and one button.make cell selection
I have an HTML table in my jsp page. This conains text fields and
I have a html table like this: Invoice# Due Date Balance Select 12345 12/25/2011
I have a table in HTML. The contents of this table are dynamically populated.
I have made a web user control (.ascx) which consists of the two html
http://jsfiddle.net/Cyjye/ I m new to jquery. I have made html table shown in jsfiddle.Firstly
Question for YUI experts... I have a table and I've made each cell of
I have HTML table. I'm looping through table and iterate over each row whose

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.