I've used this HTML5 sortable plugin for drag-drop. Inside that draggable section, I've editable text filed. At the time of editing, when I tried to select all text of input field by keyboard command ctrl + a, I noticed that the text had not been selected. At first, I don't understand what's the problem. For testing, I put a normal textarea inside sortable content and noticed that also not works! So, this is the issue of HTML5 sortable plugin. Here is my fiddle where you can see that first editable text's input
(which is outside/above of "Sortable Content start:" text) is working by ctrl + a command where remaining input
fields inside sortable content don't work with ctrl + a. How can I fix this?
The HTML <input> tag is used to get user input in HTML. To give a limit to the input field, use the min and max attributes, which is to specify a maximum and minimum value for an input field respectively. To limit the number of characters, use the maxlength attribute.
By default, HTML 5 input field has attribute type=”number” that is used to get input in numeric format. Now forcing input field type=”text” to accept numeric values only by using Javascript or jQuery. You can also set type=”tel” attribute in the input field that will popup numeric keyboard on mobile devices.
The <input type="number"> defines a field for entering a number. Use the following attributes to specify restrictions: max - specifies the maximum value allowed. min - specifies the minimum value allowed.
1. Using <input type="number"> The standard solution to restrict a user to enter only numeric values is to use <input> elements of type number. It has built-in validation to reject non-numerical values.
Adding this to your code should do it:
$('.section-sortable').keydown(function(e){
if (e.keyCode == 65 && e.ctrlKey) {
e.target.select()
}
})
It basically listens to keydown event on your section and if the keydown detects a Ctrl-A it "selects" the target.
Fiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With