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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T13:20:13+00:00 2026-06-13T13:20:13+00:00

I’ve created a dynamic product comparison chart. It’s basically to which data is written

  • 0

I’ve created a dynamic product comparison chart. It’s basically to which data is written to individual cells if the selection changes in the thead dropdown. I now want to add an array called “tlink” which will dynamically changes the “to website” button.

The table

<table class="table table-bordered table-striped">
<thead>
<tr>
    <th class="center"><strong>Select Product:</strong></th>
    <th>
        <select class="col2 select">
            <option>Prod1</option>
            <option>Prod2</option>
            <option>Prod3</option>
            <option>Prod4</option>
            <option>Prod5</option>
            <option>Prod6</option>
        </select>
    </th>
    <th>
        <select class="col3 select">
            <option>Prod2</option>
            <option>Prod3</option>
            <option>Prod4</option>
            <option>Prod5</option>
            <option>Prod6</option>
        </select>
    </th>
    <th>
        <select class="col4 select">
            <option>Prod3</option>
            <option>Prod4</option>
            <option>Prod5</option>
            <option>Prod6</option>
        </select>
    </th>
 </tr>
</thead>
<tbody>
<tr>
    <td><strong>Logo</strong></td>
    <td class="col2 logo"><img src="http://www.ar-productions.eu/images/demo/arp-compare-demo1.jpg"></td>
    <td class="col3 logo"><img src="http://www.ar-productions.eu/images/demo/arp-compare-demo2.jpg"></td>
    <td class="col4 logo"><img src="http://www.ar-productions.eu/images/demo/arp-compare-demo3.jpg"></td>
</tr>
<tr>
    <td><strong>Details 1</strong></td>
    <td class="col2 d1"><img src="http://www.ar-productions.eu/images/icons/green-tick.png"></td>
    <td class="col3 d1"><img src="http://www.ar-productions.eu/images/icons/red-x.png"></td>
    <td class="col4 d1"><img src="http://www.ar-productions.eu/images/icons/green-tick.png"></td>
</tr>
<tr>
    <td><strong>Details 2</strong></td>
    <td class="col2 d2">Some Details</td>
    <td class="col3 d2">Details go here</td>
    <td class="col4 d2">Details or some other things</td>
</tr>
  <tr>
    <td><strong>Details 3</strong></td>
    <td class="col2 d3">More text about this</td>
    <td class="col3 d3">wow, more text</td>
    <td class="col4 d3">More details go here wow</td>
  </tr>
  <tr>
    <td><strong>Details 4</strong></td>
    <td class="col2 d4">Even more details here</td>
    <td class="col3 d4">Even more text and details</td>
    <td class="col4 d4">Almost forgot - more here</td>
  </tr>
 <tr>
    <td><strong>Rating Icons</strong></td>
    <td class="col2 rating">3 stars</td>
    <td class="col3 rating">1 stars</td>
    <td class="col4 rating">5 stars</td>
  </tr>
  <tr>
    <td><strong>Link to website</strong></td>
    <td class="col2 tlink"><a href="#" target="_blank" class="button-more">Link Button</a></td>
    <td class="col3 tlink"><a href="#" target="_blank" class="button-more">Link Button</a></td>
    <td class="col4 tlink"><a href="#" target="_blank" class="button-more">Link Button</a></td>
  </tr>
  </tbody>
</table>

The script

var data = {
"details":
    {
    "info": [
        {
        "name": "Prod1",
        "logo": "http://www.ar-productions.eu/images/demo/arp-compare-demo1.jpg",
        "d1": "http://www.ar-productions.eu/images/icons/green-tick.png",
        "d2": "Some Details",
        "d3": "More textsbout this",
        "d4": "Even more details here",
        "rating": "3 stars",
        "tlink": ""
        },
    {
        "name": "Prod2",
        "logo": "http://www.ar-productions.eu/images/demo/arp-compare-demo2.jpg",
        "d1": "http://www.ar-productions.eu/images/icons/red-x.png",
        "d2": "Details go here",
        "d3": "wow, more text",
        "d4": "Even more text and details",
        "rating": "1 star",
        "tlink": ""
        },
    {
        "name": "Prod3",
        "logo": "http://www.ar-productions.eu/images/demo/arp-compare-demo3.jpg",
        "d1": "http://www.ar-productions.eu/images/icons/green-tick.png",
        "d2": "Details or some other things",
        "d3": "More details go here wow",
        "d4": "Almost forgot - more here",
        "rating": "5 stars",
        "tlink": ""
        },
    {
        "name": "Prod4",
        "logo": "http://www.ar-productions.eu/images/demo/arp-compare-demo4.jpg",
        "d1": "http://www.ar-productions.eu/images/icons/red-x.png",
        "d2": "Some other things",
        "d3": "What should I say",
        "d4": "details go here wow",
        "rating": "4 stars",
        "tlink": ""
        },
     {
        "name": "Prod5",
        "logo": "http://www.ar-productions.eu/images/demo/arp-compare-demo5.jpg",
        "d1": "http://www.ar-productions.eu/images/icons/green-tick.png",
        "d2": "Dunno what to say",
        "d3": "Nice Optics",
        "d4": "State of the art blabla",
        "rating": "4 stars",
        "tlink": ""
        },
     {
        "name": "Prod6",
        "logo": "http://www.ar-productions.eu/images/demo/arp-compare-demo6.jpg",
        "d1": "http://www.ar-productions.eu/images/icons/red-x.png",
        "d2": "cheap case",
        "d3": "pictures pixeled",
        "d4": "red eyes from flash",
        "rating": "1 star",
        "tlink": ""
        }
    ]}
};

$(".select").change(function() {
var jthis = $(this);
var whichCol;
if (jthis.hasClass("col2")) {
    whichCol = "col2";
} else if
    (jthis.hasClass("col3")) {
    whichCol = "col3";
} else if
(jthis.hasClass("col4")) {
    whichCol = "col4";
}
$.each(data.details.info, function(i, v) {
    if (v.name == jthis.val()) {
        $("td." + whichCol + ".name").html(v.name);
        $("td." + whichCol + ".logo").html("<img src='" + v.logo + "' />");
        $("td." + whichCol + ".d1").html("<img src='" + v.d1 + "' />");
        $("td." + whichCol + ".d2").html(v.d2);
        $("td." + whichCol + ".d3").html(v.d3);
        $("td." + whichCol + ".d4").html(v.d4);
        $("td." + whichCol + ".rating").html(v.rating);
        $("td." + whichCol + ".tlink").html(v.tlink);
        return;
    }
});

});

You can also see the chart in action on my jfiddle. The string to load is:

<a href="#" target="_blank" class="button-more">Link Button</a>

as you can see this already contains a class which is part of the theme framework drawing a CSS button. So I need to be able to call the exact string.

Thanks in advance!

  • 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-13T13:20:14+00:00Added an answer on June 13, 2026 at 1:20 pm

    Just use the line

    $("td." + whichCol + ".tlink").html('<a href="'+v.tlink+'" target="_blank" class="button-more">Link Button</a>');
    

    to set the inner HTML of your td cell.
    As v.tlink is set as the href attribute, just set http://www.google.com as the tlink in your data.

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

Sidebar

Related Questions

Basically, what I'm trying to create is a page of div tags, each has
I am trying to understand how to use SyndicationItem to display feed which is
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I would like to run a str_replace or preg_replace which looks for certain words
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have an autohotkey script which looks up a word in a bilingual dictionary
I have an array which has BIG numbers and small numbers in it. I
I have a text area in my form which accepts all possible characters from

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.