-
Notifications
You must be signed in to change notification settings - Fork 723
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Disable key #431
Comments
Hi @traumatic! If you look at the various demos available on the Home wiki page, you'll find this one - "Disable Accept & Bksp keys when preview is empty". I took that demo and modified it to include the space: http://jsfiddle.net/Mottie/egb3a1sk/1161/ $(function() {
var toggleKeysIfEmpty = function( kb ) {
var toggle = kb.$preview.val() === '';
kb.$keyboard
.find('.ui-keyboard-bksp, .ui-keyboard-accept, .ui-keyboard-space')
.toggleClass('disabled', toggle)
.prop('disabled', toggle);
};
$('#keyboard').keyboard({
visible : function(e, keyboard) {
toggleKeysIfEmpty( keyboard );
},
change: function (e, keyboard) {
toggleKeysIfEmpty( keyboard );
}
});
}); Is that what you wanted? |
Thanks Mottie. That example works very well. I replaced Now type any first letter and afterwards space. In my case that leads to multiple spaces being added. |
LOL, that is interesting.... When the space key is used, the I tried to clear the repeater in that function, but it still adds an extra space. So the easiest solution would be to set the I'll push a fix for this - that doesn't need |
Wow, thanks for the quick fix Mottie. Keep up that great work!! |
Hi, I was wondering whether Keyboard provides a function which allows to disable keys.
E.g. in my case I want that the space key is disabled as long as text input is empty.
Thanks!
The text was updated successfully, but these errors were encountered: