JSFiddle - React, Tailwind, and code Playground
by Trisox
HTML
<form action="" method="post" name="frm_aanmelden" id="formValidation" >
<div class="test"> 1 <input type="checkbox" name="test" value="" checked="checked"></div>
</form>
<div class="test"> 2 <input type="checkbox" name="test" value=""></div>
<div class="test"> 3 <input type="checkbox" name="test" value=""></div>
JavaScript
$(".test").click(function(event) {
var $target = $(event.target);
if( $target.is(":checked") ) {
$(".test :checked").parent().appendTo($('#formValidation'));
}
$(".test :not(:checked)").parent().insertAfter('#formValidation');
});