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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T13:49:56+00:00 2026-05-31T13:49:56+00:00

There are 25 rows in a table. Each row has an attribute, an image(tick

  • 0

There are 25 rows in a table. Each row has an attribute, an image(tick symbol) and 5 radio buttons rating the said attribute from 1-5. when one of the buttons is clicked, I want the image(tick symbol) which is previously hidden by css to be made visible.

The html is

         <table>

                <tr>
                    <td width="15px"><img id="1ai" src="../PNG Files/Untitled-3.gif" /></td>
                    <td style="text-align: left" >Course Structure and it's revelence</td>
                    <td width="6%"><input type="radio" name="1a" value="5" id="1a1" /></td>
                    <td width="6%"><input type="radio" name="1a" value="4" id="1a2" /></td>
                    <td width="6%"><input type="radio" name="1a" value="3" id="1a3" /></td>
                    <td width="6%"><input type="radio" name="1a" value="2" id="1a4" /></td>
                    <td width="6%"><input type="radio" name="1a" value="1" id="1a5" /></td>
                </tr>
                <tr bgcolor="#FCFFE8">
                    <td width="15px"><img id="2ai" src="../PNG Files/Untitled-3.gif" /></td>
                    <td style="text-align: left" >Syllabus and it's coverage</td>
                    <td width="6%"><input type="radio" name="2a" value="5" id="2a1" /></td>
                    <td width="6%"><input type="radio" name="2a" value="4" id="2a2" /></td>
                    <td width="6%"><input type="radio" name="2a" value="3" id="2a3" /></td>
                    <td width="6%"><input type="radio" name="2a" value="2" id="2a4" /></td>
                    <td width="6%"><input type="radio" name="2a" value="1" id="2a5" /></td>
                </tr>
         </table>

The images have been hidden through CSS. Javascript should identify which radio button is checked and then make visible the corresponding image.

  • 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-31T13:49:57+00:00Added an answer on May 31, 2026 at 1:49 pm

    You can do that like this:

    $("table input[type='radio']").click(function() {
        $(this).closest("tr").find("img").show();
    });
    

    When a radio is clicked, it will find the parent row of the one that is clicked, find the image in that row and show it. This assumes that the image is previously hidden with display: none.

    For better long term maintenance, you should:

    1. Put an ID on the table so this code can make sure and select only the desired table (not all tables in the document).
    2. Put a class name on the image you want to show so it can be uniquely targeted and there is no risk of getting any other image that might be added to the table in the future.

    Once, you had done these two steps, the code might look like this:

    $("#choices input[type='radio']").click(function() {
        $(this).closest("tr").find(".tick").show();
    });
    

    If you had to do it in plain javascript without a full selector engine, then I’d do it differently by manufacturing the id value of the image. Assuming you had put the “choices” id on the table, it would go something like this:

    // add event cross browser
    function addEvent(elem, event, fn) {
        if (elem.addEventListener) {
            elem.addEventListener(event, fn, false);
        } else {
            elem.attachEvent("on" + event, function() {
                // set the this pointer same as addEventListener when fn is called
                return(fn.call(elem, window.event));   
            });
        }
    }
    
    addEvent(document.getElementById("choices"), "click", function(e) {
        // use event bubbling to look at all radio clicks 
        // as they bubble up to the table object
        var target = e.target || e.srcElement;
        if (target.tagName == "INPUT" && target.type == "radio") {
            // manufacture the right ID and make that image visible
            var name = target.name;
            document.getElementById(name + "i").style.display = "inline";
            console.log("show image " + name + "i");
        }    
    });
    

    And here’s a working example: http://jsfiddle.net/jfriend00/uMUem/

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

Sidebar

Related Questions

I have around 100thousand rows in a mysql table, where each row has about
I have a table with some rows, each row has a unique key. When
I have a table style page with rows. Each row has a checkbox. I
I have a table with rows in, and each row has a few <td>
I have a table where each row has a timestamp. Is there a query
My mysql database has a table with several hundred thousand rows. Each row has
I have a table of 50 odd rows with 11 columns. Each row has
Well, I was trying to select rows from one table if there are no
So I have a table that's basically a tree. Each row has a parent
I want to add Rows to a Table that already exists and each row

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.