I have a button called "run" and there are 3 fucntions that happen when this run button is clicked. However i think because there are so many functions firing when this button is clicked, it starts to mess up on the 3rd function which does not seem to work.
the first function checks to see if any div that starts with the name "Drop" has the class "wrong", if so then it shows a dialog box appears
code:
$("#run").click(function() {
if ($("[id^='Drop']").hasClass("wrong")) {
$("#Incorrect").dialog("open");
}
});
the second function checks to see if any of the Divs starting with "Drop" are empty, if there is an empty Div it will show the dialog box
code:
$("#run").click(function(){
if ($("[id^='Drop']").is(":empty")){
$("#Wrong2").dialog("open");
};
});
the third function will play a video if there are no divs with the class wrong AND if there are no empty divs.
$("#run").click(function(){
if ($("[id^='Drop']").not(":empty") && $("[id^='Drop']").not(".wrong")){
$('#map1').get(0).play();
};
});
Now both the 1st and 2nd functions are working correctly, however function 3 is not working. The video just ignores the conditions and plays anyway. I need it to only play when the conditions have been met
I know this is a horrible way of setting this all up, I've only recently started working with jquery so if anyone could help me in with i would very much appreciate it.