royale-asjs
royale-asjs copied to clipboard
unable to use TextArea.setSelectionRange(0,0)
i am unable to use setSelectionRange(0,0) on a textarea component tried on both jewel and spectrum
tried all these option input.text = ""; // Clear the box input.focus();// Set focus above two works fine
- input.element.setselectionRange(0, 0); // - NOT ACCEPTING
- document.getElementById("input").setSelectionRange(0, 0); // - NOT ACCEPTING
- var nativeInput:* = input.element as Object; if (nativeInput && nativeInput.setSelectionRange != null) { nativeInput.setSelectionRange(0, 0); }
tried all 3 options none works - plz suggest some
@sanjeev-rajput Try input.element.focus()
@piotrzarzycki21 input.element.focus() is not the issue infect we don't have to use with element, it is working fine with input.focus().
allow me elaborate the use case
- user type in a textarea
- hit enter
- textarea is set to blank using input.text=""
- focus set to textarea using input.focus()
- user can start typing again - now here when a user press enter, cursor goes to the next line as the default behavior of textarea but we want to remove this next line and cursor set to the 0,0 position