Enable/disable virtual keyboard
Posted
by
dr.Xis
on Stack Overflow
See other posts from Stack Overflow
or by dr.Xis
Published on 2012-11-18T03:26:40Z
Indexed on
2012/11/18
5:00 UTC
Read the original article
Hit count: 142
I'm using a virtual keyboard. I have a checkbox that controls whether the virtual keyboard is displayed or not. The thing is that I don't understand how to disable it. I try to unbind it but it doesn't work...
I also tried to use namespaces and then unbind all namespaces but still the keyboard remains accessible after a click on the text box.
<input class="virtualKeyboardField ui-keyboard-input ui-widget-content ui-corner-all" data-val="true" data-val-required="The User name field is required." id="loginUserName" name="UserName" type="text" value="" aria-haspopup="true" role="textbox">
<script type="text/javascript">
$(function () {
//show login
$("#showLogin").on({
click: function () {
$("#loginFormDiv").toggle("slow");
}
});
$("#cb_showVKey").on('click', CheckIsToShowKey);
});
function CheckIsToShowKey(event) {
//var isCheck = $("#cb_showVKey").is(':checked');
//alert("ischecked? " + isCheck);
if ($("#cb_showVKey").is(':checked')) {
//if checked
BindKeyboards();
} else {
//not checked
UnBindKeyboards();
}
}
function bindVirtualKeyboards() {
$("#loginForm").delegate(".virtualKeyboardField", "click.xpto", BindKeyboards);
}
function UnBindKeyboards() {
$("#loginForm").undelegate(".virtualKeyboardField", "click.xpto", BindKeyboards);
}
function BindKeyboards() {
// alert(event.currentTarget.id);
//alert("xpto");
if ($("#cb_showVKey").is(':checked')) {
$("#loginUserName").keyboard({
layout: 'qwerty',
lockInput: true,
preventPaste: true
});
$("#loginUserPassword").keyboard({
layout: 'qwerty',
lockInput: true,
preventPaste: true
});
}
}
$(document).ready(function () {
$("#loginForm").validate();
BindKeyboards();
});
</script>
Any help guys?
© Stack Overflow or respective owner