Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't "check" dynamically created checkbox jQuery
    primarykey
    data
    text
    <p>I am making a modal popup and i dynamically add some data to it, along with a couple checkboxes. There is a checkbox that "Selects All" checkboxes in a certain section, which works alright, except for the fact that the "Select All" checkbox doesn't get checked off unless I double click it, which essentially envokes the click function twice. </p> <pre><code>$('#delAllSampleTwo').live('click',function(){ $('.delAllSampleTwo').prop("checked", !$('.delAllSampleTwo').prop("checked")); $('.delTwo').prop("checked", !$('.delTwo').prop("checked")); }); </code></pre> <p>the .delTwo class code works correctly. but not the delAllSampleTwo, and yes the ID and Class of them are the same, i tried with just id or just class but couldn't get it to work correctly.</p> <p>Here is the HTML string being returned from the JQuery code;</p> <pre><code> &lt;table style=\'width: 685px;\' cellpadding=\'0\' cellspacing=\'0\'&gt; &lt;tr&gt; &lt;td style=\'width:20px;\'&gt;&lt;a href=\'#\' class=\'toggleReportTwo\'&gt;&lt;/a&gt;&lt;/td&gt; &lt;td style=\'width:315px; text-align:left; font-weight:bold;\'&gt;Sample Report Two&lt;/td&gt; &lt;td style=\'font-weight:bold; width:140px; text-align:right;\'&gt;10/3/2013,9:52:40 AM&lt;/td&gt; &lt;td style=\'font-weight:bold; width:150px; text-align:left; padding-left:6px;\'&gt; &lt;a href=\'#\' class=\'viewIndReports\'&gt;View All in One PDF&lt;/a&gt; &lt;/td&gt; &lt;td style=\'width:70px;\'&gt; &lt;input type=\'checkbox\' id=\'delAllSampleTwo\' class=\'delAllSampleTwo\'/&gt;All &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;div id=\'sampleTwoReports\'&gt; &lt;table style=\'width: 685px;\' cellpadding=\'0\' cellspacing=\'0\'&gt; &lt;tr&gt; &lt;td style=\'width:20px;\'&gt;&lt;/td&gt; &lt;td style=\'width:315px; text-align:left;\'&gt;CHIN KIM&lt;/td&gt; &lt;td style=\'width: 140px; text-align:right; padding-right:4px;\'&gt;&amp;nbsp;&lt;/td&gt; &lt;td style=\'width:150px; text-align:left; padding-left:6px;\'&gt; &lt;a class=\'viewIndReports\' href=\'#\' target=\'_blank\'&gt;View&lt;/a&gt; &lt;/td&gt; &lt;td style=\'width:70px;\'&gt; &lt;input type=\'checkbox\' id=\'delCHIN KIM\' class=\'delTwo\'/&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;/div&gt; </code></pre>
    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