[jquery] Disable Buttons in jQuery Mobile

For jQuery Mobile 1.4.5:

for anchor buttons, the CSS class is: ui-state-disabled, and for input buttons it is just enough to toggle the disabled attribute.

_x000D_
_x000D_
function toggleDisableButtons() {_x000D_
  $("#link-1").toggleClass("ui-state-disabled", !$("#link-1").hasClass("ui-state-disabled"));_x000D_
  $("#button-1").attr("disabled") ? $("#button-1").removeAttr("disabled") : $("#button-1").attr("disabled","");_x000D_
}
_x000D_
<!DOCTYPE html>_x000D_
<html>_x000D_
<head>_x000D_
  <meta charset="utf-8">_x000D_
  <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">_x000D_
  <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.css">_x000D_
  <script src="https://code.jquery.com/jquery-1.11.2.min.js"></script>_x000D_
  <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.js"></script>_x000D_
</head>_x000D_
<body>_x000D_
<div data-role="page" id="page-1">_x000D_
  <div role="main" class="ui-content">_x000D_
    <button class="ui-btn" onclick="toggleDisableButtons();">Toggle disabled</button>_x000D_
    <a id="link-1" href="#" class="ui-btn ui-state-disabled">Anchor</a>_x000D_
    <button id="button-1" disabled="">Button</button>_x000D_
    _x000D_
  </div>_x000D_
</div>_x000D_
</body>_x000D_
</html>
_x000D_
_x000D_
_x000D_

BTW, for input buttons, there is an alternate method:

Enable:

$(".class").prop("disabled", false).removeClass("ui-state-disabled");

Disable:

$(".class").prop("disabled", true).addClass("ui-state-disabled");