Check all / uncheck all Checkbox not worked in Ajax Called Page
<p>Select All Input Checkbox is doesn't work. 
I checked the code without ajax call, then select all checkbox is perfectly worked. 
When select all checkbox is checked all the checkbox shown inside the while loop is checked.But when i integrated with main html page the select all checkbox is not worked. 
please tell me What changes i need to apply for the correct working of select all checkbox with below code.</p>

<p><strong>HTML Page</strong></p>

<pre><code>  &lt;html&gt;
  &lt;head&gt;
  &lt;script src="js/jquery-1.10.2.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
    $(function(){
      $('.parent').on('click', function() {
          var checked = this.checked;
          $(this).parents('table').find('.child').each(function() {
            this.checked = checked;
          });
      });
    });
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form  name="form1" method="post"  enctype="multipart/form-data" action="pras.php" class="form-horizontal" &gt;                                                
&lt;fieldset&gt;
&lt;div class="form-group"&gt;
&lt;label for="select111" class="col-md-2 control-label"&gt;Select Division&lt;/label&gt;
&lt;div class="col-md-10"&gt;
&lt;select name="divis" id=division class="form-control" onchange="showUsers(this.value)"&gt;                                         

&lt;/select&gt;
  &lt;/div&gt;
&lt;/div&gt;
&lt;div id="txtHint"&gt;&lt;b&gt;&lt;/b&gt;&lt;/div&gt; 
    &lt;div class="form-group"&gt;
        &lt;p align="center"&gt; 
        &lt;input class="btn btn-primary" type="submit" name="submit" value="submit"&gt;
        &lt;/p&gt;
    &lt;/div&gt;
&lt;/fieldset&gt;
&lt;/form&gt;
&lt;script&gt;
function showUsers(vari) {
if (vari== "" &amp;&amp; vari== 0) {
    document.getElementById("txtHint").innerHTML = "";
    return;
} else { 
    if (window.XMLHttpRequest) {
        // code for IE7+, Firefox, Chrome, Opera, Safari
        xmlhttp = new XMLHttpRequest();
    } else {
        // code for IE6, IE5
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xmlhttp.onreadystatechange = function() {
        if (xmlhttp.readyState == 4 &amp;&amp; xmlhttp.status == 200) {
            document.getElementById("txtHint").innerHTML = xmlhttp.responseText;
        }
    }
    xmlhttp.open("GET","get_user_div.php?&amp;variable="+vari,true);
    xmlhttp.send();
}
}
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p><strong>get_user_div.php</strong></p>

<pre><code> echo "&lt;table class='table table-bordered'&gt;
&lt;tr&gt;
 &lt;th&gt;Register Number&lt;/th&gt;
 &lt;th&gt;Prasent/Abstent &lt;/br&gt; Select All &lt;input type='checkbox' name='select1' id='select1' class='parent' /&gt;
 &lt;/th&gt;
 &lt;/tr&gt;";
 while($row = mysql_fetch_array($result)) {
$sql="SELECT * FROM attandance WHERE register_no= '$row[register_no]'";
$res = mysql_query($sql);
$col = mysql_fetch_array($res);
echo "&lt;tr&gt;";
echo "&lt;td&gt;" . $row['register_no'] . "&lt;/td&gt;";
echo "&lt;td&gt;
        &lt;input type ='checkbox' name='present[]' value='$row[register_no]' class='child' id='check[]'/&gt;
      &lt;/td&gt;";
 echo "&lt;/tr&gt;";
}

  echo '&lt;/tr&gt;';
  echo "&lt;/table&gt;";
</code></pre>