+ 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

11th Jul 2018, 7:49 PM
Roel
Roel - avatar
8 Respostas
+ 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%
13th Jul 2018, 4:11 PM
Roel
Roel - avatar
0
.toUpperCase() will be useful. I will try writing a caps function in a moment.
11th Jul 2018, 10:38 PM
James
James - avatar
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() ); }
11th Jul 2018, 11:08 PM
James
James - avatar
0
see what's going on for q and w https://code.sololearn.com/Wh2jM6q1y5mA/?ref=app
11th Jul 2018, 11:34 PM
Микола Федосєєв
Микола Федосєєв - avatar
0
... and some more modifications to change button content on depend of caps state. https://code.sololearn.com/W6gjWhOe3p8R/?ref=app
12th Jul 2018, 12:27 AM
Микола Федосєєв
Микола Федосєєв - avatar
0
https://code.sololearn.com/Wnl7HeyOrU20/?ref=app Roel Is this what you want?
13th Jul 2018, 4:05 PM
Nommer101
Nommer101 - avatar
0
I can reduce it more probably. ;)
13th Jul 2018, 4:13 PM
Nommer101
Nommer101 - avatar
13th Jul 2018, 10:44 PM
Микола Федосєєв
Микола Федосєєв - avatar