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

  • Home
  • SEARCH
  • 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 8724279
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T07:47:49+00:00 2026-06-13T07:47:49+00:00

I have a jsfiddle here which you can use to see a basic demo

  • 0

I have a jsfiddle here which you can use to see a basic demo of my application and the problem I am having.

When you open fiddle please follow these steps below:

  1. You will see an “Open Grid” link, click on the link and select either “True or False” or “Yes or No” buttons.
  2. After selecting either of the buttons you will see their answer buttons appear underneath.
  3. Please click on the “Add Question” button and this will appended a table row into the table underneath.
  4. Now in the appended row is the problem. If you click on the “Open Grid” link within the appended row and select either of the buttons, you will realise that the corresponding answer buttons underneath disappears. They should be displayed not disappear.

So my question is that can anyone modify the demo so that they can get the corresponding answer buttons to appear within the appended row when the user clicks on the “Open Grid” link in the appended row?

I think the problem maybe within this code but I am not sure:

 var count = 0;
var plusbutton_clicked;
var gQuestionIndex = 0;

function insertQuestion(form) {

    var context = $('#optionAndAnswer');
    var currenttotal = context.find('.answerBtnsOn').length;




    var $tbody = $('#qandatbl > tbody');
    var $tr = $("<tr class='optionAndAnswer' align='center'>");
    var $td = $("<td class='extratd'>");
    var $options = $("<div class='option'>1. Option Type:<br/></div>");
    var $answer = $("<div class='answer'>3. Answer:<br/></div>");

    gQuestionIndex++;

    $('.gridTxt', context).each(function() {

        var $this = $(this);
        var $optionsText = $("<input type='text' class='gridTxtRow maxRow' readonly='readonly' />").attr('name', $this.attr('name') + "[]").attr('value', $this.val()).appendTo($options).after("<span href='#' class='showGrid'>[Open Grid]</span>");

        $questionType = $this.val();

    });

    var $this, i = 0,
        $row, $cell;
    $('#optionAndAnswer .answers').each(function() {
        $this = $(this);
        if (i % 7 == 0) {
            $row = $("<tr/>").appendTo($answer);
            $cell = $("<td/>").appendTo($row);
        }
        var $newBtn = $(("<input class='answerBtnsRow answers' type='button' style='display:%s;' onclick='btnclick(this, " + gQuestionIndex + ");' />").replace('%s', $this.is(':visible') ? 'inline-block' : 'none')).attr('name', "value[" + gQuestionIndex + "][]").attr('value', $this.val()).attr('class', $this.attr('class')).attr('id', $this.attr('id') + 'Row');
        $newBtn.appendTo($cell);

        i++;
    });



    $tr.append($td);
    $td.append($options);
    $td.append($answer);
    $tbody.append($tr);

    count++;

    $('#optionAndAnswer .answerBtns').hide();

    $('#optionAndAnswer .answerBtns').removeClass('answerBtnsOn').addClass('answerBtnsOff');

    updateAnswer($answer, gQuestionIndex);


}

Thanks

  • 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-06-13T07:47:51+00:00Added an answer on June 13, 2026 at 7:47 am

    I think the main problems may be in insertQuestion().

    As far as I can tell :

    • $cell is defined conditionally but the line $newBtn.appendTo($cell); is unconditional. When the condition is not met, the append statement will fail silently (no error message).
    • even on the occasions that the condition is met $newBtn is successfully appended to $cell, and $cell is appended to $row, but $row is never appended to anything. Consequently no newBtns will appear in the DOM.

    Edit:

    Try replacing :

        if (clickedNumber === 'True or False') {
            $(this).closest('.option').siblings('.answer').find('input[name="answerName[True]"]').show();
            $(this).closest('.option').siblings('.answer').find('input[name="answerName[False]"]').show();
        } else if (clickedNumber === 'Yes or No') {
            $(this).closest('.option').siblings('.answer').find('input[name="answerName[Yes]"]').show();
            $(this).closest('.option').siblings('.answer').find('input[name="answerName[No]"]').show();
        }
    

    with :

    var ans = $(this).closest('.option').siblings('.answer').find('input');
    if (clickedNumber === 'True or False') {
        ans.filter('[value="True"], [value="False"]').show();
    } else if (clickedNumber === 'Yes or No') {
        ans.filter('[value="Yes"], [value="No"]').show();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a test application here which you can use: Please follow steps below
I have a drop down menu which you can see here on jsfiddle .
I have a jsfiddle application which you can access here . Now when you
I have a layout setup which can be view here: http://jsfiddle.net/Pn3ts/ It all works
I have a problem with a float which overflows ( JSFiddle here ). HTML
I have the following problem: http://jsfiddle.net/DerNa/12/ Which is demonstrated more clearly the jump here:
JSfiddle: http://jsfiddle.net/ybZvv/57/ I have a fiddle here where the user can append row and
In the code below and demo here http://jsfiddle.net/jasondavis/vp2YN/3/ you can see I need to
I have a Jsfiddle application here . If you type in a question in
I have a fiddle here - http://jsfiddle.net/hhimanshu/SDr3F/2/ The left pane is already available I

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.