Note that there are some explanatory texts on larger screens.

plurals
  1. POmultiple toggle for different elements add remove class
    text
    copied!<p>Her is my function. there only think its not working is when i click .close-hideme i want to remove class noactive and add class active</p> <pre><code>$(function () { var text = $(this).text(); $(".hideme").hide(); var elements = $(".bold_blue, .bold_blue_img"); elements.click(function () { var element = $(this); elements.removeClass("active"); if (text == 'dot' || text == '+' &amp;&amp; !$(".hideme").is(":visible")) { $(this).closest('tr').find(".bold_blue_img").text($(this).closest('tr').find(".bold_blue_img").text() == '-' ? '+' : '-'); $(this).closest('tr').find(".bold_blue_img").removeClass("active").addClass("noactive"); return false; } else { $(this).parents("tr").next().slideToggle("slow"); $(this).closest('tr').find(".bold_blue_img").text($(this).closest('tr').find(".bold_blue_img").text() == '-' ? '+' : '-'); $(this).closest('tr').find(".bold_blue_img").toggleClass('noactive'); return false; } }); $('.close-hideme').bind('click', function () { if (!$(".hideme").is(":visible")) { $(this).closest('tr').find(".bold_blue_img").removeClass("noactive").addClass("active"); $(this).parents(".hideme").hide("slow"); return false; } }); }); </code></pre> <p>any one have idea how to change that class to active, here html code</p> <pre><code>&lt;table style="width:100%"&gt; &lt;tbody&gt; &lt;tr class="parent"&gt; &lt;td&gt;&lt;a class="bold_blue"&gt;dot&lt;/a&gt;&lt;a class="bold_blue_img active"&gt;+&lt;/a&gt; &lt;!-- i've to use 2 different hrefs here plus is text only but inside css there is class active and noactive with background images --&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr class="hideme"&gt; &lt;td&gt;&lt;a class="close-hideme right"&gt;X&lt;/a&gt; &lt;!-- this button is not working, i mean is hiding but is not changing bold_blue_img class to active --&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt; &lt;/table&gt; </code></pre>
 

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