I am trying to understand how to get this to work and I am unsure...
I have multiple parent divs (the droppables) and multiple child divs (the draggables).
The child divs contain a form and the form contains many input tags.
All of the input elements are required and I want user to enter a value in it. If they are empty and user does not enter value in it and if the user drags any one of them within any parent div, I want the child div to be validated. If the validation fails then I want the child div to revert back to its location.
$( ".parent" ).droppable({
accept: ".child",
activeClass: "ui-state-hover",
hoverClass: "ui-state-active",
tolerance:'pointer',
drop: function( event, ui ) {
//validate and then reject if it fails???
$( this )
.addClass( "ui-state-highlight" )
.find( "p" )
.append(ui.draggable).animate({width:'100',height:'100'});
}
});
$( ".child" ).draggable();
I can't figure out how to implement this Example:
http://jsfiddle.net/Dyawa/7/
Is it possible for child div to revert back to its original position if the name of the child is empty?