I have created an on-screen keyboard in HTML using <div>
and <a>
tags. On the page there are six text inputs (firstName, nickname, lastName, notes, allergies, mobileNumber). I'm not that great at JS but I do know how to do it if there is just one input on the page but I'm not sure how to do it when there are multiple. Part of what I'm struggling with is the input box loses focus as soon as I click on a letter.
How do I append the letter to the selected input and not lose focus on that input? This is what I use to append a letter to one input when it is the only input on the page:
var setClickEvents = function () {
$('.keyboard a.digit').unbind('click').click(function () {
$name = $("input[id$='tbSearchBox']");
$name.val($name.val() + $(this).html());
});
}
HTML keyboard button--just one letter but it is the same style/setup for all letters and numbers:
<a href="#" class="btn btn-default btn-lg digit">q</a>