Hi, i'm trying to make this work but i can't!

I cleaned a code and fix the codestyle. I edited it to my needs, but i'm stuck when i'm trying to make links to change when the variable language is changed. Sorry my english is bad.

I'd like to make patches links (second table) to change when language is changed. When you change the region or the language, the client downloads (first table links) change to the selected language, but patches no.

Here is the code, also you can check how it works:

Stylesheets and jscripts are in /css and /jscript. But you can check it in the source view page of the explorer.

Please help me! I don't know what more to do.

Thanks!

P.D.: The page will be loaded by a framework, so i have to clean all the unnecessary code in the scripts and css stylesheet, some tip or help would be great. Also the background need to be blank, so ¿how can i do that without break the table style?

Dani AI

Generated

Two quick, practical fixes that address the symptoms seen here (client download links update but patch links do not):

The HTML structure must be valid. Table rows cannot be direct children of a DIV. Browsers will implicitly close and re-parent table tags when markup is invalid, so JavaScript that targets rows or their siblings often fails. Keep every row inside a proper table/tbody and mark rows with classes or data attributes that identify language/region.

Use classes/data-attributes rather than trying to wrap rows in a non-table element or relying on duplicated IDs. IDs must be unique; classes can be reused. For example:

<tr class="patch-row" data-game="wow" data-client="full" data-region="NA" data-lang="es">
  <td>Patch 4.3</td>
  <td><a class="patch-link" href="/patches/wow/full/NA/es/patch4.3.exe">Download</a></td>
</tr>

Toggle visibility by selecting those attributes. This keeps logic simple and avoids brittle ID concatenation:

function showFor(game, client, region, lang) {
  $('.patch-row').hide(); 
  var sel = '.patch-row[data-game="'+game+'"][data-client="'+client+'"][data-region="'+region+'"][data-lang="'+lang+'"]';
  $(sel).show();
  console.log('matched', $(sel).length, 'rows for', sel);
}

CSS notes and pitfalls: do not use .show { display:block } for table rows — that breaks table layout. Either remove a .hidden{display:none} class to let the row revert to its native display, or use .visible { display: table-row } when you add a show class. jQuery’s .show() correctly restores display: table-row for TRs.

Debug checklist

  • Inspect DOM in devtools to confirm rows live inside tbody.
  • Verify the patch rows actually have the attributes/classes your selector expects.
  • Use console.log(selector, $(selector).length) to confirm selectors match the intended rows.
  • Ensure no duplicated IDs are being used.

As suggested, grouping by language is fine, but make the grouping compatible with table semantics. Fixing markup and switching to attribute-based selectors will make the patch links update reliably when language or region changes.

Recommended Answers

All 3 Replies

My suggestion is use the jquery to do it.
1. put the contents all together but dividing them using div with a id="language", class="hide".
2. add CSS .hide{display:none;} .show{display:block;}.
3. when language changed, jQuery('#language').addClass('show').siblings('.show').removeClass('show').

Hope this do help you.

Well, i put the patches code in a div:

<div class="hide" id="language">
    <tr class="language-pack language-pack-wow-full language-pack-wow-full-NA hidden">
        patches code here
    </tr>
    ...
</div>

But don't work... i updated it: www.wow-spain.tk/downloads.html

Can you explain it plz?

Maybe the problem is: (download.js)

        // enable the download links
        $('#' + id + ' .download a').addClass('hidden');
        $('#win-' + game + '-' + client + '-' + region + '-' + lang).removeClass('hidden');
        $('#mac-' + game + '-' + client + '-' + region + '-' + lang).removeClass('hidden');
        $('#pdf-' + game + '-' + client + '-' + region + '-' + lang).removeClass('hidden');

If this is true, why only works on the first <td class="download win"> ??
Only can be one download win class???

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.