Ver Mensaje Individual
  #2 (permalink)  
Antiguo 12/12/2012, 14:15
Avatar de quike88
quike88
 
Fecha de Ingreso: agosto-2008
Mensajes: 471
Antigüedad: 15 años, 8 meses
Puntos: 87
Respuesta: Saber posicion del cursor dentro de textarea

Hola,

Puedes probar con este plugin:

Código Javascript:
Ver original
  1. (function ($, undefined) {
  2.     $.fn.getCursorPosition = function() {
  3.         var el = $(this).get(0);
  4.         var pos = 0;
  5.         if('selectionStart' in el) {
  6.             pos = el.selectionStart;
  7.         } else if('selection' in document) {
  8.             el.focus();
  9.             var Sel = document.selection.createRange();
  10.             var SelLength = document.selection.createRange().text.length;
  11.             Sel.moveStart('character', -el.value.length);
  12.             pos = Sel.text.length - SelLength;
  13.         }
  14.         return pos;
  15.     }
  16. })(jQuery);

Modo de uso:

Código Javascript:
Ver original
  1. $("#mi_campo").getCursorPosition();

Nos comentas como te va!

Un saludo