<?xml version="1.0" encoding="utf-8"?>
			
			<rss version="2.0" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://web.resource.org/cc/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd">

			<channel>
			<title>Building Blocks - Javascript</title>
			<link>http://www.ajaxcf.com/blog/index.cfm</link>
			<description>tips for constructing next generation AJAX &amp; ColdFusion applications</description>
			<language>en-us</language>
			<pubDate>Thu, 09 Sep 2010 03:04:42 -0000</pubDate>
			<lastBuildDate>Tue, 17 Apr 2007 17:05:00 -0000</lastBuildDate>
			<generator>BlogCFC</generator>
			<docs>http://blogs.law.harvard.edu/tech/rss</docs>
			<managingEditor>joe@ajaxcf.com</managingEditor>
			<webMaster>joe@ajaxcf.com</webMaster>
			<itunes:subtitle></itunes:subtitle>
			<itunes:summary></itunes:summary>
			<itunes:category text="Technology" />
			<itunes:category text="Technology">
				<itunes:category text="Podcasting" />
			</itunes:category>
			<itunes:category text="Technology">
				<itunes:category text="Tech News" />
			</itunes:category>
			<itunes:keywords></itunes:keywords>
			<itunes:author></itunes:author>
			<itunes:owner>
				<itunes:email>joe@ajaxcf.com</itunes:email>
				<itunes:name></itunes:name>
			</itunes:owner>
			
			<itunes:explicit>no</itunes:explicit>
			
			
			
			
			
			<item>
				<title>Disabling Text Selection For Drag-and-Drop</title>
				<link>http://www.ajaxcf.com/blog/index.cfm/2007/4/17/Disabling-Text-Selection-For-DragandDrop</link>
				<description>
				
				A common usability problem encountered in Ajax apps is the unintentional selection of text when trying to do a drag-and-drop operation.  This javascript function allows you to disable text-selection for a specific element on the page and should work in all modern browsers:

&lt;code&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function disableSelection(element) {
    element.onselectstart = function() {
        return false;
    };
    element.unselectable = &quot;on&quot;;
    element.style.MozUserSelect = &quot;none&quot;;
    element.style.cursor = &quot;default&quot;;
}
&lt;/script&gt;
&lt;/code&gt;

You can&apos;t disable text selection with CSS alone because returning false from the onselectstart event is necessary to disable selection in Internet Explorer.  You may want to also change the cursor when mousing over your draggable item with a style of &quot;cursor:default&quot; or &quot;cursor:pointer&quot;.  Even better yet, you can use &quot;cursor:hand&quot; to indicate that dragging is possible.

Here&apos;s how you would call it in your page:
&lt;code&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
disableSelection(document.getElementById(&quot;text&quot;));
&lt;/script&gt;
&lt;/code&gt;

Should you actually need to copy and paste, you can always view the source.
				
				</description>
						
				
				<category>Javascript</category>				
				
				<pubDate>Tue, 17 Apr 2007 17:05:00 -0000</pubDate>
				<guid>http://www.ajaxcf.com/blog/index.cfm/2007/4/17/Disabling-Text-Selection-For-DragandDrop</guid>
				
				
			</item>
			
		 	
			</channel></rss>