By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,384 Members | 1,886 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,384 IT Pros & Developers. It's quick & easy.

IE: select() method on an editable anchor object

P: n/a
Hello everybody,

I am using an HTML anchor "<A contenteditable=true></A>" element with
the property 'contenteditable=true' to make it editable for the user.

Inside JScript or JavaScript I am looking for a way to select the
content of this anchor via Code.
There is already the JScript method "select()" but it works only on
INPUT and TEXTAREA objects and not on A objects.

Please any advice? Thanks in advance.

Good bye -
Termin_Terminator
Aug 1 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Termin_Terminator wrote:
I am using an HTML anchor "<A contenteditable=true></A>" element with
the property 'contenteditable=true' to make it editable for the user.

Inside JScript or JavaScript I am looking for a way to select the
content of this anchor via Code.
There is already the JScript method "select()" but it works only on
INPUT and TEXTAREA objects and not on A objects.
select is an IE DOM method, not a JScript method.
As for selecting the contents of an element with IE, create a range with
the element, then call the select method:

var element = document.getElementById('someElementId');
var range = document.body.createTextRange();
range.moveToElementText(element);
range.select();

--

Martin Honnen
http://JavaScript.FAQTs.com/
Aug 1 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.