luke121 luke121 - 2 years ago 113
Javascript Question

issues with jQuery accept

Firstly apologises if this already on stack overflow. I have 3 blocks, one of these blocks need to be dragged into the target segment. unfortunately when I drag any of the 3 blocks I the code executes. If the user drags the incorrect block I simply want it to do nothing. I am new to coding, but from what I've read the following:

accept: "#Proof";

should work, however it seems not. Help is greatly appreciated. Please note I must do this in jQuery as it's for an education project.

Many thanks



accept: "#Proof";
drop: function (event, ui){
$("#Proof").html("Success!!<br> Please now press submit");
$("#target").css("background-color", "#00cc00");
$(".falseTarget").css("background-color", "#00cc00");

Answer Source

There is a typo issue in your code.

    accept: "#Proof"; // <-- replace ';' by ','
    drop: function (event, ui) {...}
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download