Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

11
LINES

< > BotCompany Repo | #1032550 // js_autofocusCaretToEnd

JavaX fragment (include) [tags: use-pretranspiled]

Libraryless. Click here for Pure Java version (4348L/25K).

static JS js_autofocusCaretToEnd(S inputFieldSelector) {
  ret jsRequiringJQuery([[
    $(document).ready(function() {
      var input = $($inputFieldSelector);
      if (input.length != 1) return;
      var len = input.val().length;
      input[0].focus();
      input[0].setSelectionRange(len, len);
    });
  ]], +inputFieldSelector);
}

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: 73 / 102
Version history: 2 change(s)
Referenced in: [show references]