Pol
Pol

Reputation: 25545

Where is the syntax error in this bit of JavaScript?

Error from firebug:

missing ) after condition
[Break on this error] else if (($(this).parent...nt().hasClass('plaing')==true) ) {

The code:

$(".myButtonPlay").live('click',function(){
     if ($(this).parent().parent().hasClass('current')==false){  

       console.log($(this).children().attr('src'));
       var media=$(this).parent().parent().attr('media');
       var id=$(this).parent().parent().attr('id');
       $(this).parent().parent().addClass('plaing');

       $(this).find('img').attr('src','http://localhost:8000/silver/images/btn_pause.gif')
       play_media(media, id);


            }
      else if (($(this).parent().parent().hasClass('current')==true) $$ ($(this).parent().parent().hasClass('plaing')==true) ) {   
     $(this).parent().parent().removeClass('plaing');
      $('#mediaPlayer').attr('player').pause();
      $(this).find('img').attr('src','http://localhost:8000/silver/images/btn_pause.gif');

          }
     else  if ( ($(this).parent().parent().hasClass('current')==true) $$ ($(this).parent().parent().hasClass('plaing')==false)  ){    
     $(this).find('img').attr('src','http://localhost:8000/silver/images/btn_paly.gif');
     $(this).parent().parent().addClass('plaing');
     $('#mediaPlayer').attr('player').play();

         }

});

Where is the problem? Looks like error is in conditions of second if statement....

Upvotes: -1

Views: 398

Answers (3)

JoshNaro
JoshNaro

Reputation: 2097

JSLint is your friend, or at least it want's to be.

Upvotes: 0

Florian
Florian

Reputation: 538

$$ is not a valid operator. Reading your code it seems like you were trying to use the && operator.

Upvotes: 0

nico
nico

Reputation: 51640

Unless I'm missing something, $$ is not an operator... maybe you meant &&?

Upvotes: 6

Related Questions