Ver Mensaje Individual
  #2 (permalink)  
Antiguo 04/04/2010, 13:29
Dany_s
 
Fecha de Ingreso: diciembre-2009
Ubicación: Misiones
Mensajes: 867
Antigüedad: 14 años, 5 meses
Puntos: 65
Respuesta: Autocompleter + AJAX + live() ? JQUERY!

pero para agregar nuevos campos no hace falta el evento live, no hace falta para crearlos
si no funciona el autocompleter es porque no tiene el live pero igual probá asignandole el plugin al crearlos

Código Javascript:
Ver original
  1. $('a#moreFields').click(function() { // when you click the add link
  2.             $('<tr id="input'+i+'"><td><input class="autoComplete" type="text" value="" name="producto[]" /></td><td><input type="text" value="" name="cantidad[]" /></td><td><input type="text" value="" name="precio[]" /></td></tr>').appendTo('#productos'); // append (add) a new input to the document.
  3.             $('tr:last').find('input.autoComplete').autocomplete("http://wwwsandbox/facturas/getNames.php", {selectFirst: true, autoFill: true, minChars: 4, lineSeparator: ';;' });
  4.             i++;
  5.             return false;
  6.         });

ahi cuando agregar el input a la tabla busco el último input con clase autoComplete (o sea el que agregué) y le asigno el autocompleter