trying to add if/else statement to drag and drop interaction in jquery
Hi,
Below is the drag and drop interaction for jquery I am trying to use: It works but when I to add the if statements below to the interaction it does not work. Can anyone review my code and get back to me on to resolve this problem.
$(document).ready(
function(){
alert("ready");
$("#draggable-1").draggable();
$("#draggable-2").draggable();
$("#droppable").droppable({
drop: function(event, ui)
{
$(this)
.addClass("ui-state-highlight")
.find("p")
.html("Dropped!");
alert("value of drop " +$(ui.draggable).attr("id"));
}
});//end drop function area
if($(ui.draggable).attr("id") == draggable-1)
{
planChosen = 1;
}
else
if($(ui.draggable).attr("id") == draggable-2)
{
planChosen = 2;
}
});//End of document ready function