+ 1
Problems with javascript keyboard
I know there are a lot buttons i havent add yet, but i wanted to focus on the caps/shift button, i have tried mutiple things, but i still didnt find out how to uppercase single characters https://code.sololearn.com/WhIjcUdXYy8a/?ref=app
8 Réponses
+ 2
Nommer101 Yeah, it was, but I was also searching for a way to capitalize the characters inside the buttons, but I used the answer of Микола Федосєєв, since he he answered me 6 days ago and had the best answer then, I used his code which also reduced my javascript code with about 70%
0
.toUpperCase() will be useful. I will try writing a caps function in a moment.
0
This will change the last letter of #txt into a capital. Now make a toggle to run something similar after each keypress while caps is on.
function caps(){
$("#txt").html(
$("#txt").html().slice(0, -1) +
$("#txt").html().charAt(
$("#txt").html().length - 1
).toUpperCase()
);
}
0
see what's going on for q and w
https://code.sololearn.com/Wh2jM6q1y5mA/?ref=app
0
... and some more modifications to change button content on depend of caps state.
https://code.sololearn.com/W6gjWhOe3p8R/?ref=app
0
https://code.sololearn.com/Wnl7HeyOrU20/?ref=app
Roel Is this what you want?
0
I can reduce it more probably. ;)
0
Try to reduce the following:
https://code.sololearn.com/W3llOhZDiyXM/?ref=app