Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The code you posted is missing a few closing brackets at the end, I'm not sure if you simply didn't copy/paste it all, or if it's missing and breaking your code:</p> <p>This is what you posted (after tidying up indentation):</p> <pre><code>if (isChildAvail == "true") { $(this).change(function () { if ($(this).is(':checked')) { alert("test"); $(this).parent().parent().append('&lt;div id="divedit" class="editdiv"&gt;&lt;p id="p_childlabel" class="childlabel"&gt;Children : ' + ChilAvailCount + ' &lt;/P&gt;&lt;a class="childlabeledit"&gt;Edit&lt;/a&gt;&lt;/div&gt;'); $('.editdiv a').click(function () { $(this).parent().parent().append($("#divchildcontrol")); EditForPullups(); }); } } </code></pre> <p>It is missing the end of the change event handler <strong>);</strong> as well as the closing bracked for the if block <strong>}</strong>:</p> <pre><code>if (isChildAvail == "true") { $(this).change(function () { if ($(this).is(':checked')) { alert("test"); $(this).parent().parent().append('&lt;div id="divedit" class="editdiv"&gt;&lt;p id="p_childlabel" class="childlabel"&gt;Children : ' + ChilAvailCount + ' &lt;/P&gt;&lt;a class="childlabeledit"&gt;Edit&lt;/a&gt;&lt;/div&gt;'); $('.editdiv a').click(function () { $(this).parent().parent().append($("#divchildcontrol")); EditForPullups(); }); } }); } </code></pre> <p>This (simplified) example works fine for me in IE9: <a href="http://jsfiddle.net/rT2dT/1/" rel="nofollow">http://jsfiddle.net/rT2dT/1/</a></p> <pre><code>$(':checkbox').change(function () { if ($(this).is(':checked')) { alert("test"); } }); </code></pre> <p>Alternatively, try</p> <pre><code>$(':checkbox').change(function () { if ($(this).prop('checked') === true) { alert("test"); } }); </code></pre> <p>Which jQuery version are you using?</p> <p><strong>EDIT:</strong> Following up on your 2nd edit from above:</p> <p>I see that you are attaching event handlers in an <code>each</code> loop</p> <pre><code>$('.consumer-communication-checkbox').each(function () { </code></pre> <p>I assume that that selector will be on various checkboxes on your page. Inside that <code>each</code> look, you attach change handlers like so:</p> <pre><code>$(':checkbox').change(... </code></pre> <p>This selector will give you <strong>all</strong> the checkboxes on the entire page, not just the one in scope. In each iteration of the <code>each</code> loop you are attaching one of those event handlers to every checkbox on the page. Without knowing your HTML markup, I can't tell you what is happening exactly, but this will be the reason why everything works as expected in isolated examples (like as JSFiddle.net) and returns random results in context.</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.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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