Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You aren't toggling the <code>tr</code> itself, only its siblings (with class <code>.RegText</code> and <code>.VolumeRegText</code>). You therefore have to check if these are visible when you are storing the state in the array. For this you can use <code>.is(":hidden")</code> on one of the siblings. The click function would then look like this</p> <pre><code>$('tr.subCategory1') .css("cursor", "pointer") .attr("title", "Click to expand/collapse") .click(function() { $(this).siblings('.RegText').toggle(); var isHidden = $(this).siblings('.VolumeRegText').toggle().is(':hidden'); list_Visible_Ids[$(this).attr('id')] = !isHidden ? 1 : null; }); </code></pre> <hr /> <p>There is also a lot to comment on the rest of the code. In</p> <pre><code>$('tr[@class^=RegText]').hide().children('td'); </code></pre> <p>skip the <code>.children('td')</code>, as you aren't using this selection.</p> <hr /> <p><code>list_Visible_Ids = [];</code> should be declared using <code>var</code>.</p> <p><hr /> Looping through <code>idsArray</code>, you are checking <code>this != "" || this != null)</code>, which should be using <code>&amp;&amp;</code> instead of <code>||</code>.</p> <pre><code>$.each(idsArray, function() { if (this != "" &amp;&amp; this != null) { $('#' + this).siblings('.RegText').toggle(); list_Visible_Ids[this] = 1; } }); </code></pre> <p>There's also really no point in using the <code>$.each()</code> function instead of a regular JavaScript for-loop</p> <p><hr /> It also seems you are using an old version of jQuery, since using the <code>@</code> in selectors was deprecated in <a href="http://docs.jquery.com/Release:jQuery_1.3" rel="nofollow noreferrer">version 1.3</a>.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload