Answer the question
In order to leave comments, you need to log in
Replacing keyboard button with another one in input?
Hello ! I can’t find a solution in any way, how to print special characters in the input field when clicking on the keyboard arrows?
Let's say there is an input field:
And this function:
var symbol = function(e) {
if (e.keyCode == 38) {
return String.fromCharCode('"\u00A9"');
}
}
Why doesn't the © sign appear in the input field when the up arrow is pressed?
Answer the question
In order to leave comments, you need to log in
You are returning the character but not inserting it.
Suppose you want to insert this character into <div id="some_id"></div>
To, your code should look something like this:
var symbol = function(e) {
if (e.keyCode == 38) {
var tId = document.getElementById('some_id'),
copySymb = String.fromCharCode('"\u00A9"');
tId.innerHTML = copySymb;
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question