Closed
Bug 33967
Opened 25 years ago
Closed 25 years ago
need ability to control caret position/selection in text fields from javascript
Categories
(Core :: Layout: Form Controls, defect, P1)
Core
Layout: Form Controls
Tracking
()
VERIFIED
FIXED
M16
People
(Reporter: radha, Assigned: sfraser_bugs)
Details
(Whiteboard: Composer feature work)
Need to be able to control cursor/selections in the urlbar from javascript
Comment 2•25 years ago
|
||
(making the summary more general)
Summary: Need interfaces to manipulate urlbar from javascript → need ability to control caret position/selection in text fields from javascript
Assignee | ||
Updated•25 years ago
|
Target Milestone: --- → M16
Assignee | ||
Comment 3•25 years ago
|
||
I have the underlying code working, to set the selection in
nsGfxTextControlFrame. But I have no idea how to make this accessible from
JavaScript. Any ideas, hyatt?
Comment 4•25 years ago
|
||
updating keyword and status whiteboard to reflect that this is a beta 2 feature
work bug that the Composer team deems a must fix for beta 2.
Assignee | ||
Comment 5•25 years ago
|
||
Fix checked in. You can get and set the selection in text widets thusly:
var textField = document.getElementById("foobar");
textField.setSelectionRange(0, 12);
var selStart = textField.selectionStart;
var selEnd = textField.selectionEnd;
var textLength = textField.textLength;
I also made foo.select() work for inputs and textareas.
Status: ASSIGNED → RESOLVED
Closed: 25 years ago
Component: Editor → HTML Form Controls
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•