0
var sba_dfd = $.Deferred();
/*and so on*/

$("#sbas").click(function(){
    $(this).css('background-color','#ed1c24');
    sba_dfd.resolve();
}); /*and on*/

$(".x").click(function(){
    var promise = $.when(sba_dfd.promise()/*and on*/);
    if(promise.state("resolved")){
        promise.then(function(){
            $("#true").get(0).play();
            $("#thumb").css({'background-color' : 'rgba(237,28,36,.4)'});
            $("#div,#wrapper_overlay").hide();
        });
    } else {
            $("#false").get(0).play();
    }
});

I've got a bunch of deferreds, that resolve on clicks.

The resolution of deferreds should be triggered after the click on .x, but they trigger automatically. What have I missed here?

rudolf
  • 61
  • 1
  • 7

1 Answers1

3

I think you have a syntax error

expected ')' after '}' please examine

which is common to us... so I suggest always close what you open before writing to its body.

enrico.bacis
  • 30,497
  • 10
  • 86
  • 115
  • nope, that is not the problem, I just missed it when copying, the `function` still doesn't work. – rudolf Nov 08 '12 at 12:22