Search code examples
javascriptjqueryjquery-eventsjplayer

How to bind two events at the same time using jPlayer?


I'm trying to attach two event handlers at the same time. Here is an example:

$("#jpId").bind($.jPlayer.event.loadeddata, function(event){});

$("#jpId").bind($.jPlayer.event.play, function(event){});

I don't know how but like this:

$("#jpId").bind($.jPlayer.event.loadeddata || $.jPlayer.event.play, function(event){});

I want to use this two events at same time.


Solution

  • Use the code below if you want to use anonymous function:

    $("#jpId").bind(
       $.jPlayer.event.loadeddata + ' ' + $.jPlayer.event.play,
       function(event){
          // ... skipped ...
       }
    );