check box is not checking in jQuery.1.9.1.js

check box is not checking in jQuery.1.9.1.js

here is two example one using jquery.1.5.2.min.js

http://demo.smarttutorials.net/test/table1.html

other is using jquery.1.9.1.min.js

http://demo.smarttutorials.net/test/table.html

if i add more rows using addmore button then using select_all() function i had written to check all the check boxes. it working fine in jquery.1.5.2.min.js but not working in jquery.1.9.1.min.js

here is code

<script src='jquery-1.9.1.min.js'></script>

<h1>Prescription Notes</h1>

<form id='Prescription' method='post' name='Prescription'>

<label>Prescription Details : </label>

<table border="1" cellspacing="0">
  <tr>
    <th><input class='check_all' type='checkbox' onclick="select_all()"/></th>
    <th>S. No</th>
    <th>Generic Med. Name</th>
    <th>Medicine Name</th>
    <th>Dose</th>
    <th>Frequency</th>
    <th>Duration</th>
    <th>Remarks</th>
  </tr>
  <tr>
    <td><input type='checkbox' class='case'/></td>
    <td></td>
    <td></td>
    <td></td>
    <td></td>
    <td> </td>
    <td> </td>
    <td> </td>
  </tr>
</table>

<button type="button" class='delete'>- Delete</button>
<button type="button" class='addmore'>+ Add More</button>





</form>


<script>
$(".delete").on('click', function() {
    $('.case:checkbox:checked').parents("tr").remove();

});

$(".addmore").on('click',function(){
    var data="<tr><td><input type='checkbox' class='case'/></td><td></td>";
    data +="<td></td> <td></td><td></td><td></td><td></td><td></td></tr>";
    $('table').append(data);
});

function select_all() {
    $('input[class=case]:checkbox').each(function(){
        if($('input[class=check_all]:checkbox:checked').length == 0){
            $(this).attr("checked", false);
        } else {
            $(this).attr("checked", true);
        }
    });
}



</script>