Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/04/2015, 18:10
Avatar de fede5426
fede5426
 
Fecha de Ingreso: diciembre-2014
Ubicación: Córdoba
Mensajes: 446
Antigüedad: 9 años, 9 meses
Puntos: 208
Respuesta: ¿Cómo pasar este efecto de un DIV a un INPUT?

Tal y como dijo Alexis88. Te dejo el código modificado:

Código Javascript:
Ver original
  1. $(document).ready(function (){
  2.   textEscribe("ESTE ES UN MENSAJE QUE SIMULA ESCRIBIR", '#EscribirAqui', 50);  /*cambias el id del div por el id del input*/
  3.  });
  4.  
  5.  function textLista()
  6.  {
  7.    max = textLista.arguments.length;
  8.    for (i = 0; i < max; i++)
  9.   this[i] = textLista.arguments[i];
  10.  }
  11.  
  12.  function textEscribe(txt, selector, time)
  13.  {
  14.   $(selector).empty();
  15.   var x = 0; pos = 0;
  16.   var tl = new textLista
  17.     (
  18.      txt
  19.     );
  20.   var l = tl[0].length;
  21.   textInterval(selector, tl, l, x, pos, time);
  22.  }
  23.  
  24.  function textInterval(selector, tl, l, x, pos, time)
  25.   {
  26.    var intervalo =
  27.    setInterval(function() {
  28.    $(selector).val(tl[x].substring(0,pos)); /*cambias html por val*/
  29.    if(pos++ == l)
  30.     clearInterval(intervalo);
  31.    }, time);
  32.   }

Saludos