title: Disable a button from json response
body: <p>Codepen is here: <a href="http://codepen.io/bwolfsohn/pen/jWVZwX" rel="nofollow">http://codepen.io/bwolfsohn/pen/jWVZwX</a></p>
  
  <p>Trying to disable a button via jquery on submit.</p>
  
  <p>I'm simulating an ajax response.</p>
  
  <p>The button is not disabled, but the value on the button is changed to "disabled".</p>
  
  <p>i've tried: </p>
  
  <pre><code>($d).button('disable');
  ($d).prop( "disabled", true );
  </code></pre>
  
  <p>where am i going wrong ?? </p>
  
  <p>html:</p>
  
  <pre><code>&lt;form class="form-inline bidding" id="rbconfirm" name="IamBidding" action="#"&gt;
  &lt;input id="arBidAmount_7101" type="text"  name="aBidAmount_7101" value="450.00"&gt;  
  &lt;input id="rbbutton" class="btn btn-success" type="submit" value="Bid Now"&gt;
  </code></pre>
  
  <p>jquery/js</p>
  
  <pre><code>$(function () {
  
  var obj2 = {
  "arBidAmount_7101" : {
  "value" : "500.00"
  },
  "rbbutton" : {
  "disable" : "disabled"
  }
  };
  $("#rbconfirm").submit(function(e){
   $.each(obj2, function(i, item) {
          var d = i;
          var $d = $('#' + i);
          if ($d.length !== 0) {
     $.each(item,function(i,item) {
        if ($d.is(':input')) {
          ($d).val(item);
         }
        else if (i=='disable') {
          ($d).prop( "disabled", true );
         }
        else if (i=='value') {
        ($d)[0].innerHTML = item;
        }
      else{
        if (typeof console == "object") {
          console.log('notinput '+ i + d);
         }
        }
      });
          } else {
          if (typeof console == "object") {
                console.log(i + 'notfound');
            }
          }
        });
       e.preventDefault();
       });
    });
  </code></pre>
  
  <p>Here is the corrected javascript... 
  thanks to @pranin-shakya for the key to the problem..</p>
  
  <pre><code>changing this line:
  if ($d.is(':input')) {
  
  to this line:
  if (($d.is(':input')) &amp;&amp; (!$d.is(':submit')))
  </code></pre>
  
  <p>to exclude the submit button from being evaluated as an input.</p>
  
  <pre><code>$(function () {
  
  var obj2 = {
  "arBidAmount_7101" : {
  "value" : "500.00"
  },
  "rbbutton" : {
  "disable" : "true"
  }
  };
  $("#rbconfirm").submit(function(e){
    console.log(obj2);
   $.each(obj2, function(i, item) {
          var d = i;
          var $d = $('#' + i);
          if ($d.length !== 0) {
     $.each(item,function(i,item) {
        if (($d.is(':input')) &amp;&amp; (!$d.is(':submit')))
        {
          ($d).val(item);
         }
        else if (i=='disable') {
          $($d).prop( "disabled", true );
         }
        else if (i=='value') {
        ($d)[0].innerHTML = item;
        }
      else{
        if (typeof console == "object") {
          console.log('notinput '+ i + d);
         }
        }
      });
          } else {
          if (typeof console == "object") {
                console.log(i + 'notfound');
            }
          }
        });
       e.preventDefault();
       });
    });
  </code></pre>