title: How to disable button after reaching condition in laravel
body: <p>I am using laravel and stuck in a condition. i add counter and a condition that when counter equals to 4 disable the button and no more item added. 
  this is my code</p>
  
  <pre><code>var increment = 0;
  $(document).ready(function(){
      $(".compare").click(function(){
          increment++;
          document.getElementById('compare').innerHTML = "";
          document.getElementById('compare').innerHTML = "Compare (" +increment+")";
                  if(increment == 4)
                  {
                      var array =  document.getElementsByClassName('compare');
                      for (var i = 0 ; i &lt; array.length ; i++)
                      {
                          array[i].setAttribute('disabled','');
                      }
                  }
  </code></pre>
  
  <p>i want's to disable button after reaching the limit and no more item added from anywhere if the counter equals to 4.</p>