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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:35:19+00:00 2026-05-27T02:35:19+00:00

I know a bit of PHP and so also HTML/CSS, and I have made

  • 0

I know a bit of PHP and so also HTML/CSS, and I have made a simple quiz program allowing users to create and do quizzes that are stored in a MySQL database. Now what I am trying to do is improve the usability and efficiency of the program.

On the createQuestions form, there are eight textboxes, users can fill in between 2 or 8 of these boxes with answers. Although I think this looks messy with all eight, and what I would like is to have 2 textboxes, and when there is text in the second one, the third one appears and so on.. up to eight

I spent a few hours learning a bit of basic JS, and managed to get it, so that there was a button that changed the visibility propities of the input box, label and radio button of each row. Although I wrote it really inefficiently lots of lines of code to do not much :p – giving each object a separate ID, and it still didn’t work that well.

Below is an example of how my HTML is laid out, I have eight of these, though I could replace this with one, and a PHP for loop with a limit of 8.

<div id="c">
<p class="subFont" id="cT" style="display:none;">Answer 3</p>
<input type="text" name="optionC"  class="textbox" style="display:none;" id="cI">
<input type="radio" name="correctAns" value="c" id="cR" style="display:none;">
<input type ="button" name="add" value="d" style="background-color:green;" onclick="addBox('d', 'inline')" id="cB" style="display:none;">
</div>

Any suggestions on how to write the script descried above? Please could you comment or briefly explain your workings, so I can learn from it 🙂

Thank you loads in advance, I’m so grateful to all you guys on stackoverflow 😉

ps, any suggestions for learning js resources?

  • 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-27T02:35:20+00:00Added an answer on May 27, 2026 at 2:35 am

    Pure Javascript

    to hide/show object id=”cR”

    // hide
    document.getElementById('cR').style.display = 'none';
    
    // show
    document.getElementById('cR').style.display = 'block';
    

    to append textarea to

    document.getElementById('c').innerHTML += '<textarea name=".." id=".."></textarea>';
    

    events:

    <input type="text" id="xxx" onchange="your action here" />
    

    jQuery

    to hide/show object id=”cR”

    // hide
    $('#cR').hide();
    $('#cR').fadeIn(); // with fade in effect
    
    // show
    $('#cR').show();
    $('#cR').fadeOut(); // width fade out effect
    

    to append textarea to

    $('#c').append('<textarea name=".." id=".."></textarea>');
    

    events:

    $('#xxx').change(function() {
        your action here
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've been working with PHP quiz program and I'm a bit lost on fetching
I was trying to learn unit test with PHP. I know it's a bit
I have a bit of PHP code that grabs a list of files from
I'm a little bit of a newb when it comes to PHP, but know
I know this is a bit contradicting seeing as the browser would have to
I am web programmer and I deal with html, css, javascript, php and asp.net.
I've got a simple bit of code in PHP that queries, grabs the resulting
I have a simple PHP script with a form that has two select fields,
I am new to coding and would just like to know a bit more
I know a fair bit about the Windows Task Manager in XP, but 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.