Jump to content

Recommended Posts

I'm in need of a javascript what would work like this:1. press and hold on a text row.2. Move to input field or textarea.3. release and the text is pasted.This is like drag, select a area of text and move it to textarea and it will paste.

Link to post
Share on other sites

You wouldn't be able to do that with arbitrary text, only on certain elements. You could drag an entire div, but not just highlight some text in the div and drag it. Is that what you want to do?

Link to post
Share on other sites

IE has the ability to create a TextRange object and copy and paste using the clipboard. Don't know about the other browsers. You can also set the contentEditable property to true and it does all the work

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html>	<body>		<div contentEditable="true">				Select a word and drag it around		</div>	</body></html>

Link to post
Share on other sites
You wouldn't be able to do that with arbitrary text, only on certain elements. You could drag an entire div, but not just highlight some text in the div and drag it. Is that what you want to do?
Sorry my bad, I have a list of BBcodes what I want to drag from the spot to the text area. So the text will not be any text.
Link to post
Share on other sites

You should be able to use a drag and drop library, like Walter Zorn's, and have each draggable item in its own container like a div. After getting it set up with the drag and drop library you'll only need a way to indicate which code was dropped onto the text area, which shouldn't be too difficult.http://www.walterzorn.com/dragdrop/dragdrop_e.htm

Link to post
Share on other sites
You should be able to use a drag and drop library, like Walter Zorn's, and have each draggable item in its own container like a div. After getting it set up with the drag and drop library you'll only need a way to indicate which code was dropped onto the text area, which shouldn't be too difficult.http://www.walterzorn.com/dragdrop/dragdrop_e.htm
I was thinking isn't it easier to make a <a href="b/b">b/b</a> and have some script that disables the link as destination? Edited by ckrudelux
Link to post
Share on other sites

Think I found a solution.<textarea onmouseover="this.focus();this.select();" >BBcode</textarea>but I want it to be like this<p onmouseover="this.focus();this.select();" >BBcode</p>or<span onmouseover="this.focus();this.select();" >BBcode</span>

Link to post
Share on other sites
Think I found a solution.<textarea onmouseover="this.focus();this.select();" >BBcode</textarea>but I want it to be like this<p onmouseover="this.focus();this.select();" >BBcode</p>or<span onmouseover="this.focus();this.select();" >BBcode</span>
If know one understands then changing from textarea to p or span the script don do anything. With other words don't work
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...