0

Please help me i am new in j Query and angular I have 1 Div it is Container for another Div i want to restrict Drag the Div Which contain class XYZ

user7059863
  • 61
  • 2
  • 13

1 Answers1

1

Use the cancel attribute of draggable function fiddle:

JS:

$('.drag').draggable({
    cancel: ".xyz",
    helper: function(){
        return "<span>Dragging</span>";
    }
});
$('#drop').droppable({
    accept: 'div',
    drop: function(e,ui){
        ui.draggable.text('I am draggable')
    }
})

HTML:

<div class="drag">I can be dragged</div>
<div class="drag xyz">I cannot be dragged</div>
<br/>
<br/>
<div id="drop">Drop Here</div>
RonyLoud
  • 2,408
  • 2
  • 20
  • 25