Salut. i have some problem with javascript..
I made translate script, that allows Georgian users type Georgian by Latin alphabet. So, when i manipulate on input tag, i can't set focus to the end of the text.. correctly, cursor is in the end of text but if text is much bigger than input tag, it must scroll automatically and must not hide.
here's code..
$(document).ready(function() {
$(".geok").geokbd();
});
$.fn.geokbd = function() {
symbols = "abgdevzTiklmnopJrstufqRySCcZwWxjh";
this.relatedCheckbox = $("<input type=\"checkbox\" name=\"geokbd\" />").attr('checked', true);
$(this).after(this.relatedCheckbox);
$(this).keypress(
function(e) {
if ((e.charCode) == 96) {
if ($(this).next('input').attr('checked')) {
$(this).next('input').attr('checked', false);
} else {
$(this).next('input').attr('checked', true);
}
return false;
}
if ($(this).next('input').attr('checked')) {
if ((index = symbols.indexOf(String.fromCharCode(e.charCode))) >= 0) {
ret = String.fromCharCode(index + 4304);
this.focus();
var scrollTop = this.scrollTop,
start = this.selectionStart,
end = this.selectionEnd;
var value = this.value.substring(0, start) + ret + this.value.substring(end,this.value.length);
this.value = value;
this.scrollTop = scrollTop;
this.selectionStart = this.selectionEnd = start + ret.length;
return false;
}
}
}
);
}
thanks