Libraryless. Click here for Pure Java version (4348L/25K).
1 | static JS js_autofocusCaretToEnd(S inputFieldSelector) { |
2 | ret jsRequiringJQuery([[ |
3 | $(document).ready(function() { |
4 | var input = $($inputFieldSelector); |
5 | if (input.length != 1) return; |
6 | var len = input.val().length; |
7 | input[0].focus(); |
8 | input[0].setSelectionRange(len, len); |
9 | }); |
10 | ]], +inputFieldSelector); |
11 | } |
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1032550 |
Snippet name: | js_autofocusCaretToEnd |
Eternal ID of this version: | #1032550/3 |
Text MD5: | 350e56ac2b1a9684a5d25b24653a1c15 |
Transpilation MD5: | 2e3f5c6451b60661ac46686efade3446 |
Author: | stefan |
Category: | javax / js |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2021-09-22 20:03:18 |
Source code size: | 349 bytes / 11 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 162 / 205 |
Version history: | 2 change(s) |
Referenced in: | [show references] |