1 $.fn.setCursorPosition = function(pos) {
  2 	this.each(function(index, elem) {
  3 		if (elem.setSelectionRange) {
  4 			elem.setSelectionRange(pos, pos);
  5 		} else if (elem.createTextRange) {
  6 			var range = elem.createTextRange();
  7 			range.collapse(true);
  8 			range.moveEnd('character', pos);
  9 			range.moveStart('character', pos);
 10 			range.select();
 11 		}
 12 	});
 13 	return this;
 14 };