Hi,
I need to make this work so would be thankful for some advice.
I am building a simple virtual keyboard for a touchscreen. It works with one field but I have poblems when the user needs to
select and fill many fields.
I have few input fields and one textarea. User needs to be able to select an area and write with the virtual keyboard.
My simplified javascript looks like this:
My keyboard looks like this: (From the above script I removed functionalities for caps lock, delete, uppercase letters etc because they work ok.)
Thanks for all help!
I need to make this work so would be thankful for some advice.
I am building a simple virtual keyboard for a touchscreen. It works with one field but I have poblems when the user needs to
select and fill many fields.
I have few input fields and one textarea. User needs to be able to select an area and write with the virtual keyboard.
My simplified javascript looks like this:
Code:
//Two functions are called when input field or textarea is clicked:
$("input, textarea").click(changeclasswrite);
$("input, textarea").click(touchkeyboard);
//And here are the functions:
function changeclasswrite(){
$('.write').attr('class', '');
$(this).attr('class', 'write');
}
function touchkeyboard(){
var $write = $('.write');
$('#keyboard li').click(function(){
var $this = $(this),
character = $this.html();
$('.write').attr('value', $write.val() + character);
});
};
My keyboard looks like this: (From the above script I removed functionalities for caps lock, delete, uppercase letters etc because they work ok.)
Code:
<ul id="keyboard">
<li class="symbol"><span class="off">@</span><span class="on">~</span></li>
<li class="symbol"><span class="off">1</span><span class="on">!</span></li>
<li class="symbol"><span class="off">2</span><span class="on">@</span></li>
<li class="symbol"><span class="off">3</span><span class="on">#</span></li>
<li class="symbol"><span class="off">4</span><span class="on">$</span></li>
<li class="symbol"><span class="off">5</span><span class="on">%</span></li>
<li class="symbol"><span class="off">6</span><span class="on">^</span></li>
<li class="symbol"><span class="off">7</span><span class="on">&</span></li>
<li class="symbol"><span class="off">8</span><span class="on">*</span></li>
<li class="symbol"><span class="off">9</span><span class="on">(</span></li>
<li class="symbol"><span class="off">0</span><span class="on">)</span></li>
<li class="symbol"><span class="off">-</span><span class="on">_</span></li>
<li class="symbol"><span class="off">=</span><span class="on">+</span></li>
<li class="delete lastitem"> < -- del </li>
<li class="tab">tab</li>
<li class="letter">q</li>
<li class="letter">w</li>
<li class="letter">e</li>
<li class="letter">r</li>
<li class="letter">t</li>
<li class="letter">y</li>
<li class="letter">u</li>
<li class="letter">i</li>
<li class="letter">o</li>
<li class="letter">p</li>
<li class="symbol"><span class="off">[</span><span class="on">{</span></li>
<li class="symbol"><span class="off">]</span><span class="on">}</span></li>
<li class="symbol lastitem"><span class="off">\</span><span class="on">|</span></li>
<li class="capslock">caps lock</li>
<li class="letter">a</li>
<li class="letter">s</li>
<li class="letter">d</li>
<li class="letter">f</li>
<li class="letter">g</li>
<li class="letter">h</li>
<li class="letter">j</li>
<li class="letter">k</li>
<li class="letter">l</li>
<li class="symbol"><span class="off">;</span><span class="on">:</span></li>
<li class="symbol"><span class="off">'</span><span class="on">"</span></li>
<li class="return lastitem">return</li>
<li class="left-shift">shift</li>
<li class="letter">z</li>
<li class="letter">x</li>
<li class="letter">c</li>
<li class="letter">v</li>
<li class="letter">b</li>
<li class="letter">n</li>
<li class="letter">m</li>
<li class="symbol"><span class="off">,</span><span class="on"><</span></li>
<li class="symbol"><span class="off">.</span><span class="on">></span></li>
<li class="symbol"><span class="off">/</span><span class="on">?</span></li>
<li class="right-shift lastitem">shift</li>
<li class="space lastitem"> </li>
</ul>
Thanks for all help!