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 5969347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:13:03+00:00 2026-05-22T20:13:03+00:00

I have a table and I made it editable, thats why its cells will

  • 0

I have a table and I made it editable, thats why its cells will become textbox on clicking each cell.
The code is

function changeContent(tablecell)
{
    tablecell.innerHTML = "<INPUT type=text name=newname onBlur=\"javascript:submitNewName(this);\" value=\""+tablecell.innerHTML+" \">";
    tablecell.firstChild.focus();
}

I would like to display a dropdown list instead of textbox. Also that drop down should have the options Daily and Monthly.

How can I do that?

  • 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-22T20:13:04+00:00Added an answer on May 22, 2026 at 8:13 pm

    Static strings example:

    function changeContent(tablecell)
    {
    var cellInner =  "<select name=\"newname\" onBlur=\"javascript:submitNewName(this);\">";
    cellInner += "<option>" + tablecell.innerHTML + "</option>";
    cellInner += "<option>Daily</option>";
    cellInner += "<option>Monthly</option>";
    cellInner += "</select>";
    
    tablecell.innerHTML = cellInner;
    
    tablecell.firstChild.focus();
    
    }
    

    But to be honest I do not like the static string approach. You would be better using the JS DOM functions.

    Something like:

    function changeContent(tablecell)
    {
    var dropDown = document.createElement("select");
    
    //  Set attributes.
    dropDown.name = "newname";
    //.... etc
    
    var option1 = document.createElement("option");
    option1.innerHTML = tablecell.innerHTML;
    
    var option2 = document.createElement("option");
    option2.innerHTML = "Daily";
    
    var option3 = document.createElement("option");
    option3.innerHTML = "Monthly";
    
    dropDown.appendChild(option1);
    dropDown.appendChild(option2);
    dropDown.appendChild(option3);
    
    tablecell.innerHTML = "";
    tablecell.appendChild(dropDown);
    }
    

    I haven’t tested the code so there may be some syntax errors but the principle is correct

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

Sidebar

Related Questions

Question for YUI experts... I have a table and I've made each cell of
I have a table in HTML. I have made this table as editable by
I have a table made of: <td class='editable' id='<?=data['id']?>' col='<?=data['col_name']?>'>Content</td> $data is the mysql_fetch_assoc
I have made a table containing an array editable (you can delete rows) by
So far i have made a table with products and its sums, according to
I have a table whose body I've made sortable using jQuery UI's Sortable function.
In the page Toggle Squares , I have a table made out of an
I have made a dump of my database in which one table is pretty
I have a trigger that stores changes made in a separate table when a
Hi I made this site a while ago in my table days but have

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.