Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery .click() being raised twice
    primarykey
    data
    text
    <p>This question has been asked numerous times before and I looked at the other questions, but their proposed fixes didn't apply to me.</p> <p>The problem is the <code>.click</code> handler in the <code>collapseFieldsets()</code> function is being raised twice.</p> <p>Here is my init function:</p> <pre><code>$(document).ready(function() { navigation_setup(); collapseFieldsets(); $('input[placeholder], textarea[placeholder]').placeholder(); $(window).resize( function() { var width = $(window).width(); $('h1').css('display', width &lt; 1000 ? 'none' : 'block'); } ); }); </code></pre> <p>This is my collapseFieldsets:</p> <pre><code>function collapseFieldsets() { $("fieldset.collapseable legend").css("cursor", "pointer"); $("fieldset.collapseable legend label").css("cursor", "pointer"); $("fieldset.collapsed div.fieldsetContent").hide(); $("fieldset.collapseable legend").click(function(event) { var fieldsetContent = $(this).parent().find("div.fieldsetContent"); fieldsetContent.toggle(200); }); } </code></pre> <p>And this is what my HTML looks like:</p> <pre><code>&lt;fieldset class="collapseable"&gt; &lt;legend&gt;&lt;label&gt;&lt;input checked="checked" name="ClientUpdate" type="radio" value="Current" /&gt; Mr John Smith&lt;/label&gt;&lt;/legend&gt; &lt;div class="fieldsetContent"&gt; &lt;input id="ClientCurrent_PersonId" name="ClientCurrent.PersonId" type="hidden" value="9" /&gt; &lt;!-- More input elements etc --&gt; &lt;/div&gt; &lt;/fieldset&gt; </code></pre> <p>The <code>collapseFieldsets</code> function is only called once - when I insert <code>alert</code> calls they only appear once.</p> <p>I'm using jQuery 1.9.1, but it also happens with 1.8.0.</p>
    singulars
    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