473,385 Members | 2,015 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

IE: select() method on an editable anchor object

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
1 1430
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: bengee | last post by:
Hi First off - by the word "anchor" i DON'T mean a link, i.e. <a></a> tags I'm trying to position a <select> box inside a <div>. I can use relative positioning to set where the box should...
1
by: Mad Scientist Jr | last post by:
I'm stuck trying to work with a HTML <SELECT> control and javascript (similar to DualList but that control doesn't offer enough options to totally control the text on the buttons and control, also...
2
by: Carlo Marchesoni | last post by:
I have an editable Datagrid and memorize its datasource with a Session variable. On each Page_Load I simply Bind the Datagrid. Everything works fine. The problem comes, when I have a lot of...
10
by: elibol | last post by:
Hi, Is there an event that fires when the back or forward button on a browser is pressed? I need an event to fire when someone clicks the back or forward button after an anchor has been set. ...
3
by: axlq | last post by:
I wrote the function below to get the vertical scroll position of an anchor. That is, a URL of the form http://www.example.com/mypage.html#anchorname should scroll to the point on the page that...
5
by: Randy Webb | last post by:
The list below has the current section number, proposed anchor name, and then the current title of that section. Some make sense, some don't. There are a few that don't have proposed anchor names...
3
by: Joseph Gruber | last post by:
Hi all -- I have two questions. First, I'm adding a control to my form at runtime and the control/form seems to ignore the anchor property of the runtime control. Any idea how I can get a...
1
by: jonniethecodeprince | last post by:
Hi Guys, I've been cramming in and trying the anchor() method all day but I cannot seem to find the right syntax. What does the method do? How is it different to the Link() method <script...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.