Member Avatar

i added the draggable functionality to one of my divs using the jquery-ui draggable

like in their example here http://jqueryui.com/draggable/

so if the draggable div has text inside it <div id="draggable" class="ui-widget-content"> Drag me around</div>
how can i enable the option of being able to select the "drag me around" text so i can copy it?
is it possible to make a specific area/icon inside the div that only when you click on it and drag the mouse the entire div moves, but if you click somewhere else in the div it's not going to move- and will allow to select and copy text?

Recommended Answers

You must use the cancel option: http://api.jqueryui.com/draggable/#option-cancel

<div class="draggable">
    <span class="text">SomeText</span>
</div>

$(".draggable").draggable({
    cancel: '.text'
});
Jump to Post

All 3 Replies

Member Avatar

many thanks!

You're welcome, just mark as solved please.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.21 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.