¿Cómo deshabilitar botones usando jQuery Mobile?

jQuery Mobile es una tecnología basada en la web que se utiliza para crear contenido receptivo al que se puede acceder en todos los teléfonos inteligentes, tabletas y computadoras de escritorio. En este artículo, crearemos un botón de desactivación usando jQuery Mobile.

Enfoque: Primero, agregue los scripts jQuery Mobile necesarios para su proyecto.

<enlace rel=”hoja de estilo” href=”http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css” />

<script src=”http://code.jquery.com/jquery-1.11.1.min.js”></script>

<script src=”http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js”></script>

Usaremos diferentes tipos de clases y tipos de interfaz de usuario para crear los botones de marcado.

Ejemplo 1: en este artículo, usaremos el botón con el atributo deshabilitado para deshabilitarlo

HTML

<!DOCTYPE html> 
<html> 
  
<head>
    <link rel="stylesheet" href=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
    <script src=
"http://code.jquery.com/jquery-1.11.1.min.js">
    </script>
    <script src=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
    </script>
</head>
  
<body> 
    <center>
        <h1>GeeksforGeeks</h1>
        <h4>Disable buttons using jQuery Mobile</h4>
    </center>
    
    <button disabled="">Disabled button</button>
</body> 
  
</html> 

Producción:

Ejemplo 2: en este artículo, utilizaremos la etiqueta Anchor con class=”ui-btn ui-state-disabled” para nuestro propósito.

HTML

<!DOCTYPE html> 
<html> 
  
<head>
    <link rel="stylesheet" href=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css" />
    <script src=
"http://code.jquery.com/jquery-1.11.1.min.js">
    </script>
    <script src=
"http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js">
    </script>
</head>
  
<body> 
    <center>
        <h1>GeeksforGeeks</h1>
        <h4>Disable Anchor using jQuery Mobile</h4>
    </center>
    
    <a href="https://www.geeksforgeeks.org/" 
           class="ui-btn ui-state-disabled">
          Disabled anchor
      </a>
</body> 
  
</html>

Producción:

Publicación traducida automáticamente

Artículo escrito por taran910 y traducido por Barcelona Geeks. The original can be accessed here. Licence: CCBY-SA

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *