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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T08:46:30+00:00 2026-06-12T08:46:30+00:00

Please see my jsfiddle with what I’m currently working with. I would like to

  • 0

Please see my jsfiddle with what I’m currently working with.

I would like to add an extra td after the submit button when the user presses submit. If the user selected the wrong answer, I want this td to read “Incorrect, try again”. If they are correct, I would like the td to read “Correct!”.

Now, I believe this line of code will do the trick (assuming the td in my html has a class “newtd”).

$('td.newtd').html("<span class='green'>Correct!</span>");

OR

$('td.newtd').html("<span class='red'>Incorrect, try again.</span>");

The problem I have is figuring out what modifications I need to make to my current code to get this to work. Would it be best to create an if statement checking the current class of the input? If the question is right, print the new td?

Many 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-12T08:46:31+00:00Added an answer on June 12, 2026 at 8:46 am

    jsFiddle Demo

    Well first off you need to have that td with a class of newtd in your html (or you could just remove it (if it’s there) and append it each time, whatever works for you.

    As for the IF, you can toggle the different text like so.

    var correct = $('input[type="radio"]:checked').hasClass('right');
    
    var str = '<span class="' + (correct ? 'green' : 'red') + '">' + 
            (correct ? 'Correct!' : 'Incorrect, try again.')
            + '</span>';
    
    $('td.newtd').html(str);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see this: http://jsfiddle.net/uNbYu/1/ If you click submit, the button doesn't do anything, but
I've created a jQuery UI button, and would like to add a 'X' secondary
Please see demo here: http://jsfiddle.net/9pR87/28/ Add Input - adds new row with new input
Please see this: My code looks like this now: http://jsfiddle.net/Bd9Ut/ As you can see
I've got a toggle menu, please see http://jsfiddle.net/Wp2em/41/ for code and functions. On the
Please see demo here: http://jsfiddle.net/mA6qm/1/ (expand console) Why aren't events being sent or received
Please see the demo here: http://jsfiddle.net/Freewind/Vkp4U/ The html: <div class=outer> <div class=x>x</div> <div class=y>y</div>
please see: http://jsfiddle.net/4Z4fQ/19/ consider the following html: <a id=myElement href=http://www.google.com/> <img id=image src=http://www.google.com/intl/en_com/images/srpr/logo3w.png alt=google/>
Please see: http://jsfiddle.net/XEbKy/3/ I have two layers of tabs. On the top layer I
Please see this jsFiddle: https://jsfiddle.net/Wmq6f/ I have a textarea that has a background image,

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.