IE: select() method on an editable anchor object

  • Thread starter Termin_Terminator
  • Start date
T

Termin_Terminator

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
 
M

Martin Honnen

Termin_Terminator said:
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();
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top