-
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
Open Keyboard programmatically #638
Comments
Hi @iArnoldo! Check out the main "playground" demo... click on the keyboard icon to see it working. The code is at the bottom of the JS frame. Here is the documentation on the |
Hi @Mottie , |
In the latest version of the keyboard plugin, you can add the keyboard to contenteditable elements. If that isn't what you want, then I would suggest initializing the keyboard on the input after it is added to the cell. To open the keyboard, after initialization, use the Try this (demo): HTML <table>
<thead>
<th>Test</th>
</thead>
<tbody>
<tr><td>edit me</td></tr>
<tr><td>edit me</td></tr>
</tbody>
</table> Script $(function() {
$("table").on("click", "td", function(e) {
var $cell = $(e.target),
value = $cell.text();
$cell.html('<input data-value="' + value + '" value="' + value + '">');
initKB($cell.find("input"));
});
function initKB($input, value) {
$input
.keyboard({
autoAccept: true,
initialized: function(e, kb) {
kb.reveal();
}
})
// activate the typing extension
.addTyping({
showTyping: true,
delay: 250
})
.on("accepted canceled", function(e, kb, el) {
var value = e.type === "canceled" ? $(el).data("value") : el.value;
removeKB($(el).closest("td"), value);
});
}
function removeKB($cell, value) {
$cell.find("input").getkeyboard().destroy();
$cell.text(value);
}
}); |
Thank you so much, that fixed my problem. 😄 👍 ❤️ |
I'm guessing this issue has been resolved, so I'm going to close it. If you continue to have problems, please feel free to continue the discussion in this thread. |
Hey this is rather a question than an issue, tho i hope i can still find some help.
So i have a input field which will be added dynamically on a click event. Unfortunatly in this state the virtual Keyboard will not open.
So my question is, can i somehow open the keyboard programmatically with a method like open() or a class add?
The text was updated successfully, but these errors were encountered: