Skip to main content

20 Cursos de JQuery – Eventos


Tutorial #20 del curso de jquery, en este tutorial seguimos viendo eventos nos toca ver los eventos: dbclick(), focus() y blur().

<!DOCTYPE html>
<html lang="es">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>eventos doble click, focus y blur</title>
  </head>
  <body>

    <form action="">
      <input type="text" id="texto">
      <input type="button" id="btn" value="enviar">
    </form>
   
    <script src="js/jquery-2.1.3.min.js"></script>
    <script type="text/javascript">
    $(document).ready(function() {
      $('#btn').dblclick(function(event) {
        alert("mensaje del evento doble click");
      });
      $('#texto').focus(function(event) {
        $('#texto').val('ingrese email');
      });
      $('#texto').blur(function(event) {
        $('#texto').val('');
      });

    });

    </script>
  </body>
</html>

Deja una respuesta

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

 

Este sitio usa Akismet para reducir el spam. Aprende cómo se procesan los datos de tus comentarios.