title: How i can toggle the input statue disabled
body: <p>before i ask the question i searched on Stackoverflow about this and found out that i can disable or enable the input by prop or attr, 
  but when i tried to implement this - like the following example- it does not want to toggle, am i missing something?
  thank you  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(function() {
  
    $('#submit').on('click', function() {
      $('body').prepend('&lt;div class= "item" &gt;&lt;/div&gt;');
      if ($('.item').length &gt; 0) {
        $('#search').removeAttr('disabled');
      }
      if ($('.item').length == 0) {
        $('#search').attr('disabled', 'disabled');
        //$('#search').prop('disabled', true);
  
      }
  
    });
  
    $('#reset').on('click', function() {
      $('.item').remove();
    })
  });</code></pre>
  <pre class="snippet-code-css lang-css prettyprint-override"><code>button {
    display: inline-block
  }
  
  input {
    position: fixed;
    bottom: 0;
    right: 0
  }
  
  .item {
    width: 50px;
    height: 50px;
    background: orangered;
    margin: 5px
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type='search' id='search' disabled&gt;
  &lt;button id='submit'&gt;Submit&lt;/button&gt;
  &lt;button id='reset'&gt;Reset&lt;/button&gt;</code></pre>
  </div>
  </div>
  </p>