A
A
Alex Kheben2011-08-15 23:58:09
JavaScript
Alex Kheben, 2011-08-15 23:58:09

js, html5 drag and drop objects?

Task:
1. There is an object like:

<a href="http://google.ru" title="Это Google" pic="http://localhost/pics/google_logo.jpg">Google</a>

2. There is a textarea.
It is necessary that when dragging 1 to 2, not the path text that is specified in the href attribute appears, but text like:
<a href="http://google.ru" title="Это Google"><img src="http://localhost/pics/google_logo.jpg" /></a>

To be honest, I don’t even know what request to google this for. Can you at least kick in the right direction?

Answer the question

In order to leave comments, you need to log in

6 answer(s)
J
Jazzist, 2011-08-16
@Jazzist

On the draggable release, write a handler that will catch the attributes from $(this) and insert what you need.

A
Anatoly, 2011-08-16
@taliban

javascript.ru/ui/draganddrop

D
d4rkr00t, 2011-08-16
@d4rkr00t

If html5 suits you, then you can do something like this:
http://jsfiddle.net/HyGKa/26/
PS javascript is not my forte :)

@
@ntkt, 2011-08-16
_

html5 drag item value
http://dev.w3.org/html5/spec/dnd.html#datatransfer
It?

M
mjr27, 2011-08-16
@mjr27

jqueryui.com/demos/draggable/

R
RuslanCC, 2011-08-16
@RuslanCC

Yes, the most logical thing is to use JqueryUI.
Here you can look at the events when the element is dropped .
When you link to a textarea, the dragstop event will fire. You hang a function on it that looks - where did you throw this element and if you threw it correctly - copies the link to the textarea

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question