<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.2.1" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: Working with the Cursor Position</title>
	<link>http://parentnode.org/javascript/working-with-the-cursor-position/</link>
	<description>The building blocks of a solid frontend.</description>
	<pubDate>Wed, 20 Aug 2008 07:05:22 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>

	<item>
		<title>By: Andrew</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-8875</link>
		<author>Andrew</author>
		<pubDate>Fri, 08 Feb 2008 15:45:47 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-8875</guid>
		<description>OK literally 5 minutes after I posted the above message I have discovered that setting a width on the Input box fixed the issue for IE.  However, I have also discovered during this time a bug with Firefox.  If the focus is at the very start of the input box the text is appended to the end of the input box and the input box loses focus.  This bug does not have a significant impact on my application, but I will be attempting to find a solution for it.</description>
		<content:encoded><![CDATA[<p>OK literally 5 minutes after I posted the above message I have discovered that setting a width on the Input box fixed the issue for IE.  However, I have also discovered during this time a bug with Firefox.  If the focus is at the very start of the input box the text is appended to the end of the input box and the input box loses focus.  This bug does not have a significant impact on my application, but I will be attempting to find a solution for it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-8874</link>
		<author>Andrew</author>
		<pubDate>Fri, 08 Feb 2008 15:16:17 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-8874</guid>
		<description>Hi,

Your description is not entirely true "Both work for Textareas and Inputs".   In Firefox your code does work for both textareas and inputs.  However, it does not work successfully for Inputs in IE6 and IE7.

If you use an input box in IE the text you are inserting pre-appends the whole phrase.

I am writing a search program which has buttons to insert boolean operators into a text input. (it was going to be a deprecated feature, but 30% of the users claim to find it helpful)  If anyone knows a a fix for this I would be grateful to find out.</description>
		<content:encoded><![CDATA[<p>Hi,</p>
<p>Your description is not entirely true &#8220;Both work for Textareas and Inputs&#8221;.   In Firefox your code does work for both textareas and inputs.  However, it does not work successfully for Inputs in IE6 and IE7.</p>
<p>If you use an input box in IE the text you are inserting pre-appends the whole phrase.</p>
<p>I am writing a search program which has buttons to insert boolean operators into a text input. (it was going to be a deprecated feature, but 30% of the users claim to find it helpful)  If anyone knows a a fix for this I would be grateful to find out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: steve</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-3715</link>
		<author>steve</author>
		<pubDate>Thu, 26 Jul 2007 17:16:20 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-3715</guid>
		<description>One thing I just found that was driving me bonkers (in both FIrefox and IE), was that any attempt to select a character range inside a field, will be *severely* hampered, under the following conditions.

1.) Browser has auto-completion assistance turned on.
2.) DOM Call on field to fieldObj.setAttribute('autocomplete', 'off'); is made

I *was* trying to set this attribute dynamically, on fields where I wanted "my own" widget-like behavior.  However after extensive hair pulling, I found that doing so, would cause the character range selection to FAIL.

For #2, setting the attribute directly, behaves a bit better in Firefox. e.g. fieldObj.autocomplete = 'off';

If anyone knows another way to turn it off, that doesn't affect the selection, I'd be interested in finding out how.</description>
		<content:encoded><![CDATA[<p>One thing I just found that was driving me bonkers (in both FIrefox and IE), was that any attempt to select a character range inside a field, will be *severely* hampered, under the following conditions.</p>
<p>1.) Browser has auto-completion assistance turned on.<br />
2.) DOM Call on field to fieldObj.setAttribute(&#8217;autocomplete&#8217;, &#8216;off&#8217;); is made</p>
<p>I *was* trying to set this attribute dynamically, on fields where I wanted &#8220;my own&#8221; widget-like behavior.  However after extensive hair pulling, I found that doing so, would cause the character range selection to FAIL.</p>
<p>For #2, setting the attribute directly, behaves a bit better in Firefox. e.g. fieldObj.autocomplete = &#8216;off&#8217;;</p>
<p>If anyone knows another way to turn it off, that doesn&#8217;t affect the selection, I&#8217;d be interested in finding out how.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Disgrunt</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2712</link>
		<author>Disgrunt</author>
		<pubDate>Thu, 14 Jun 2007 14:21:50 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2712</guid>
		<description>This would be nice if it worked. I copied your code right from your site and it just doesn't work in IE 6 or 7.  I am using an input type=text with this and it keeps prepending the text at the beginning of the text box. Nice try though.</description>
		<content:encoded><![CDATA[<p>This would be nice if it worked. I copied your code right from your site and it just doesn&#8217;t work in IE 6 or 7.  I am using an input type=text with this and it keeps prepending the text at the beginning of the text box. Nice try though.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: labilbe</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2647</link>
		<author>labilbe</author>
		<pubDate>Tue, 12 Jun 2007 13:46:42 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2647</guid>
		<description>Thank you very much with this code which saved my day :-)</description>
		<content:encoded><![CDATA[<p>Thank you very much with this code which saved my day :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: SOmeONE</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2151</link>
		<author>SOmeONE</author>
		<pubDate>Sat, 05 May 2007 10:28:27 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2151</guid>
		<description>Very nice tutorial indeed, but if it was much simpler, i could use it.</description>
		<content:encoded><![CDATA[<p>Very nice tutorial indeed, but if it was much simpler, i could use it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Roman</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2127</link>
		<author>Roman</author>
		<pubDate>Thu, 03 May 2007 16:21:03 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-2127</guid>
		<description>This simply doesn't work, I'm no expert, but this code does not recognise the browsers' object model correctly. I'm testing with IE6 and Firefox 2.0.0.3, the code fails to work on both browsers.

I found a working solution at http://www.laviska.com/view.php?id=138 though. I don't know if this solution is worth anything in the long run, but for now it does a splendid job and it seems extremely simple too.</description>
		<content:encoded><![CDATA[<p>This simply doesn&#8217;t work, I&#8217;m no expert, but this code does not recognise the browsers&#8217; object model correctly. I&#8217;m testing with IE6 and Firefox 2.0.0.3, the code fails to work on both browsers.</p>
<p>I found a working solution at <a href="http://www.laviska.com/view.php?id=138" rel="nofollow">http://www.laviska.com/view.php?id=138</a> though. I don&#8217;t know if this solution is worth anything in the long run, but for now it does a splendid job and it seems extremely simple too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dave F</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-1806</link>
		<author>Dave F</author>
		<pubDate>Wed, 28 Mar 2007 15:34:16 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-1806</guid>
		<description>Worked great for me except for one thing. In Firefox it inserted text into both textbox and textarea at the cursor.
IE7 also inserted correctly for textarea.
However, in IE7, it put the inserted text at the beginning of the textbox, no matter where the cursor was.
Any thoughts on what to look for to fix this?</description>
		<content:encoded><![CDATA[<p>Worked great for me except for one thing. In Firefox it inserted text into both textbox and textarea at the cursor.<br />
IE7 also inserted correctly for textarea.<br />
However, in IE7, it put the inserted text at the beginning of the textbox, no matter where the cursor was.<br />
Any thoughts on what to look for to fix this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: BÃ¸t</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-1705</link>
		<author>BÃ¸t</author>
		<pubDate>Sun, 18 Mar 2007 17:36:45 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-1705</guid>
		<description>Nice indeed! This code solved my problem. However, you do not write a anything about copyrights, so I hope you allow me to copy these functions into my own project?</description>
		<content:encoded><![CDATA[<p>Nice indeed! This code solved my problem. However, you do not write a anything about copyrights, so I hope you allow me to copy these functions into my own project?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jamie</title>
		<link>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-1513</link>
		<author>Jamie</author>
		<pubDate>Tue, 06 Mar 2007 15:04:01 +0000</pubDate>
		<guid>http://parentnode.org/javascript/working-with-the-cursor-position/#comment-1513</guid>
		<description>Hi White,

Thanks for the code, its great.

However, I think there is a bug finding the cursor position, if you try enter the same text as is there already.

My original text in the text area is:
james is james
*james ok

I try to insert the text "James " without the quotes.

If I position my cursor after the asterix and click "Insert text" then the new cursor position is incorrect.
Howver, if I select the asterix and "Insert text" to replace the asterix the new cursor position is correct.

Thanks,
Jam.</description>
		<content:encoded><![CDATA[<p>Hi White,</p>
<p>Thanks for the code, its great.</p>
<p>However, I think there is a bug finding the cursor position, if you try enter the same text as is there already.</p>
<p>My original text in the text area is:<br />
james is james<br />
*james ok</p>
<p>I try to insert the text &#8220;James &#8221; without the quotes.</p>
<p>If I position my cursor after the asterix and click &#8220;Insert text&#8221; then the new cursor position is incorrect.<br />
Howver, if I select the asterix and &#8220;Insert text&#8221; to replace the asterix the new cursor position is correct.</p>
<p>Thanks,<br />
Jam.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
