How to not allow deleting all rows in table?
<p>I have a simple table with 3 columns with classes = "code","description","delete" the column has class "delete" is a checkbox type, and one button with class="savebtn".</p>

<p>I need the following :</p>

<p>When user click save :</p>

<ol>
<li>the Jquery must verify the code column that it has data.</li>
<li>If any cell in delete column is checked, Delete that row.</li>
<li>If the user checked all cells in delete column alert message that the table must has at least one row , and don't delete the rows.</li>
</ol>

<p>this is a <a href="https://jsfiddle.net/ko55Lbt3/" rel="nofollow">Demo</a> but it not working with me.</p>

<p>that what i tried :</p>

<pre><code>$(document).ready(function (){ 
$(".savebtn").bind("click", function(e){
    $('.savebtn').attr('disabled',true);
    $('.table tbody tr').each(function () {
       $(this).find('.code input').each(function () {
           if ($(this).closest("tr").find(".delete input").is(":checked")  &amp;&amp; $('.cf-table-block tbody tr').length &gt;=1){
               $('.delete input :checkbox:checked').closest('tr').remove();
               $('.savebtn').removeAttr('disabled');
           }else if($(this).closest("tr").find(".delete input").is(":checked")  &amp;&amp; $('.cf-table-block tbody tr').length &lt;2){
               e.preventDefault();
           }else if($('.delete input').prop('checked')==false &amp;&amp; ( $(this).val().length&gt;0)){
               $('.savebtn').removeAttr('disabled');
           }else if ($('.delete input').prop('checked')==false &amp;&amp; ( $(this).val().length==0)){
               $(this).attr("placeholder", "Please fill this field");
            }
          });
      });
   });
});
</code></pre>