Demo of setting and getting disabled option for droppable
Drag me to my destination
change the option below to disable or enable the droppable.
HTML
<div class='row'> <div class='col-md-6'>
<div id="draggable" class="ui-widget-content">
<p>Drag me to my destination</p>
</div>
</div><div class='col-md-2'>
<div id="droppable" class="ui-widget-header" >
<p>Dropp here</p>
</div>
</div></div>
change the option below to disable or enable the droppable.
<div id=d1></div>
<br>
<div class='radio-inline'>
<label><input type='radio' name='r1' id='r1' value='true' > True</label>
</div>
<div class='radio-inline'>
<label><input type='radio' name='r1' id='r2' value='false' checked>False</label>
</div>
jquery
<script>
$(document).ready(function() {
///////////
$( function() {
$( "#draggable" ).draggable({
});
});
///////////
$( "#droppable" ).droppable({
drop: function( event, ui ) {
$( this )
.find( "p" )
.html( "Welcome Dropped!" );
}
});
///////////////
var status_used = $( "#droppable" ).droppable( "option", "disabled" );
$('#d1').html( " <b>Status of option : disabled </b> " + status_used );
////////////
$("input:radio[name=r1]").click(function() {
var sel = ($(this).val() == 'true');
$( "#droppable" ).droppable( "option", "disabled", sel );
var status_used = $( "#droppable" ).droppable( "option", "disabled" );
$('#d1').html( " <b>Status of option : disabled </b>: " + status_used );
})
///////////////////////
})
</script>