Check Box don't work

Check Box don't work

Hi guys I have a question for you, I have in my code:
  1.  A checkBox that disabled an input field;
  2.  A select that if set to empty:
    1. reset and disabled the input field;
    2. set the checkBox to checked;
Why if I uncheck the checkBox and I set the select as empty the checkBox seems unchecked ???


This is my code:
  1. <select class="select">
  2.     <option value=''>Select</option>
  3.     <option value="1">Option1</option>
  4. </select>
  5. <label>code:</label>
  6. <input disabled class="code"></input>
  7. <input disabled checked type="checkBox" class="check" title="Uncheck to Enable"></input>

  1. $(document).on('click', '.select', function(){
  2.     if($(this).val() == ''){
  3.         $('.check').attr('disabled', true);
  4.         $('.check').attr('checked', true);
  5.         $('.code').attr('disabled', true);
  6.         $('.code').val('');
  7.     }
  8.     else{
  9.         $('.check').attr('disabled', false);}
  10. });

  11. $(document).on('change', '.check', function(){
  12.     if($(this).is(':checked'))
  13.          $('.code').attr('disabled', true);
  14.     else
  15.         $('.code').attr('disabled', false);
  16. });