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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T15:17:25+00:00 2026-05-27T15:17:25+00:00

I have an application which you can test in my jsfiddle to see how

  • 0

I have an application which you can test in my jsfiddle to see how it works, jsfiddle. Now what this app does is allow users to select options and answers for each question, (the app on jsfiddle does not show the question as it is not needed for this question).

Now what happens is the user selects an option, types in the number of answers he/she wants and then selects the answers from the buttons below. The user will add a question and then a new row will appear in the table showing the answers selected.

Example on how to use the app so you can try it yourself in jsfiddle:

  1. open the grid (open grid link) and select option “4”.

  2. Type in number 2 in the “Number of Answers” Textbox (#numberAnswerTxt)

  3. Select Buttons “A” and “C”.

  4. Click on “Add Question” button.

Now as you can see a new table row appears but nothing is under the “Answer2 column except an empty textbox. (Don’t need textbox).

What I want is the exact copy of the Answers buttons (if you follow example in fiddle then its Buttons “A” to “D” with “A” and “C” selected) to be displayed in the “Answer” column when an answer is submitted in a new table row. I want to show it as the buttons as they are but I have absolutly no idea how to do this.

Does anyone know how to do it?

The code which controls the new table row for the “Answer” column is below:

cell = document.createElement("td");
 cell.className = "answer";
 input = document.createElement("input");
 input.name = "answer_" + qnum;
 cell.appendChild(input);
 row.appendChild(cell);

This can be found in the function insertQuestion(form) which is near the end of the Jsfiddle Javascript section.

  • 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-27T15:17:25+00:00Added an answer on May 27, 2026 at 3:17 pm

    I’m not sure if this is what you have in mind, but the following modified function will copy the selected buttons (without the on/off class and events) to the new row. Adjust as necessary by adding additional classes to get the styling exactly the way you want. Note I recommend not setting the style property directly on the element as you are doing. It should be enough to use CSS to do this, perhaps using a rule with :nth-child to get the wrapping you need. See an updated fiddle at http://jsfiddle.net/YTh5Y/.

    // make the counter global so that it isn't reset with each function call,
    // though it looks like you could get it from an input on the page.  That
    // or figuring out the next number from the existing rows would be better.
    var qnum = 1;
    function insertQuestion(form) {
        // make the row
        var $html = $("<tr><td class='qid'>" + qnum + "</td></tr>");
        // make the column element where the answers will go
        var $td = $("<td class='answer'></td>");
        // for each selected answer button, construct a new one and append it to the column
        $('#optionAndAnswer .answerBtnsOn').each( function() {
            var $this = $(this);
            var $newBtn = $("<input class='answerBtns' type='button' style='display: inline-block;' />").attr('name',$this.attr('name'))
                       .attr('value',$this.attr('value'))
                       .attr('id','qid' + qnum + '-' + $this.attr('id')); // must be unique
            $td.append($newBtn);
        });
        // add column to row
        $html.append($td);
        // add row to table and update counter
        $('#qandatbl').append($html);
        form.numberOfQuestions.value = qnum;
    
        ++qnum;
        $("#questionNum").text(qnum);
        form.questionText.value = "";
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a jsfiddle application which you can access here . Now when you
I have an application in which you can accept friend request. For this purpose
I have two async classes in my application which you can see below class
I have a small question. How can I test an application which uses the
I have a silverlight application which works perfectly and can access the WCF services
I have an application which requires authentication, but has some related services which can
I have a console application which can also open winform under certain conditions.Processing(its a
We have a delphi application which can also run as a sevice . We
I have a socket application which I can use in local network, at home.
I have a console application from which I create a window. I can render

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.