Revision 3355f79b-a3ab-48f3-8d7c-1694d9bb6cd8 - Stack Overflow
I cant get this to work. I am trying to replace certain characters when a key is pressed. It works fine when I use the variable replace_list instead of replace_list["russian"], but I need different "replace lists" for other things. What am I doing wrong?
<script type="text/javascript" src="javascript/jquery.js"></script>
<input id=answer>
<script>
replace_list = ["russian": {'a' : 'b', 'c' : 'd'}];
$(document).ready(function () {
$("#answer").keydown(function () {
var text = $(this).val();
$.each(replace_list["russian"], function (index, value) {
if (index == text.substring(text.length - value.length)) {
$("#answer").val(text.substring(0, text.length - value.length) + value);
}
});
});
})
</script>