Ich möchte eine Taste drücken, die nur gedrückt werden kann, wenn alle Optionen von 1 Box in die andere Box verschoben werden.Knopf nur anklickbar machen, wenn etwas fertig ist
siehe Screenshot der Schnittstelle sind hier:
so alle Optionen von der blauen Box in der grünen Box gezogen und dann wird der Button aktiv. Ist das möglich?
mein Code:
$(document).ready(function(){
$('.next').click(function() {
$('.current').removeClass('current').hide()
.next().show().addClass('current');
if ($('.current').hasClass('last')) {
$('#next').attr('disabled', true);
}
$('#prev').attr('disabled', null);
});
});
$(document).ready(function(){
$(function() {
$("#sortable1, #sortable2").sortable({
connectWith: ".connectedSortable, .connectedSortable1"
}).disableSelection();
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.js"></script>
<link href="https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.12.1/jquery-ui.min.css" rel="stylesheet"/>
<div id='div2' class='dropboxes'>
<!--box with options to drag to the other box-->
<ul id="sortable1" class="connectedSortable">
<li class="ui-state-default" style="cursor:move;" id='I'>option1</li>
<li class="ui-state-default" style="cursor:move;" id='D'>option2</li>
<li class="ui-state-default" style="cursor:move;" id='C'>option3</li>
<li class="ui-state-default" style="cursor:move;" id='S'>option4</li>
</ul>
<!--other box where the options above can be dropped-->
<ul id="sortable2" class="connectedSortable1">
</ul>
<!--this button has to be only clickable when all the options are dragged to the other box-->
<button class="next">Volgende</button>
</div>
Wie kann ich das tun?
Sie möchten Ihre Optionen von der ersten Listbox in die zweite Listbox verschieben, richtig? –
das funktioniert bereits. Ich möchte, dass die Taste nur funktioniert, wenn alle Optionen von der ersten Box in die zweite Box verschoben wurden. – thomagron