function Alternative(options) {
    EventDispatcher.call(this);
    var self = this;

    this.options = options;

    var triggerAlternativeSelected = function (event) {
      self.trigger('alternative-selected', {
        correct: self.options.correct,
        $element: self.$alternative,
        answerIndex: self.options.answerIndex
      });

      event.preventDefault();
    };

    this.$alternative = $('<li>', {
      'class': 'h5p-sc-alternative h5p-sc-is-' + (this.options.correct ? 'correct' : 'wrong'),
      'role': 'radio',
      'tabindex': -1,
      'on': {
        'keydown': function (event) {
          switch (event.which) {
            case 13: // Enter
            case 32: // Space
              // Answer question
              triggerAlternativeSelected(event);
              break;

            case 37: // Left Arrow
            case 38: // Up Arrow
              // Go to previous Option
              self.trigger('previousOption', event);
              event.preventDefault();
              break;

            case 39: // Right Arrow
            case 40: // Down Arrow
              // Go to next Option
              self.trigger('nextOption', event);
              event.preventDefault();
              break;
          }
        }
      },
      'focus': function (event) {
        self.trigger('focus', event);
      },
      'click': triggerAlternativeSelected
    });

    this.$alternative.append($('<div>', {
      'class': 'h5p-sc-progressbar'
    }));

    this.$alternative.append($('<div>', {
      'class': 'h5p-sc-label',
      'html': this.options.text
    }));

    this.$alternative.append($('<div>', {
      'class': 'h5p-sc-status'
    }));
  }
/**
   * @constructor
   *
   * @param {object} options Options for the alternative
   */
@constructor
@param {object} options Options for the alternative
@constructor @param { object } options Options for the alternative
function Alternative(options) {
    EventDispatcher.call(this);
    var self = this;
    this.options = options;
    var triggerAlternativeSelected = function (event) {
      self.trigger('alternative-selected', {
        correct: self.options.correct,
        $element: self.$alternative,
        answerIndex: self.options.answerIndex
      });
      event.preventDefault();
    };
    this.$alternative = $('<li>', {
      'class': 'h5p-sc-alternative h5p-sc-is-' + (this.options.correct ? 'correct' : 'wrong'),
      'role': 'radio',
      'tabindex': -1,
      'on': {
        'keydown': function (event) {
          switch (event.which) {
            case 13: 
            case 32: 
              triggerAlternativeSelected(event);
              break;
            case 37: 
            case 38: 
              self.trigger('previousOption', event);
              event.preventDefault();
              break;
            case 39: 
            case 40: 
              self.trigger('nextOption', event);
              event.preventDefault();
              break;
          }
        }
      },
      'focus': function (event) {
        self.trigger('focus', event);
      },
      'click': triggerAlternativeSelected
    });
    this.$alternative.append($('<div>', {
      'class': 'h5p-sc-progressbar'
    }));
    this.$alternative.append($('<div>', {
      'class': 'h5p-sc-label',
      'html': this.options.text
    }));
    this.$alternative.append($('<div>', {
      'class': 'h5p-sc-status'
    }));
  }
function Alternative ( options ) { EventDispatcher . call ( this ) ; var self = this ; this . options = options ; var triggerAlternativeSelected = function ( event ) { self . trigger ( 'alternative-selected' , { correct : self . options . correct , $element : self . $alternative , answerIndex : self . options . answerIndex } ) ; event . preventDefault ( ) ; } ; this . $alternative = $ ( '<li>' , { 'class' : 'h5p-sc-alternative h5p-sc-is-' + ( this . options . correct ? 'correct' : 'wrong' ) , 'role' : 'radio' , 'tabindex' : - 1 , 'on' : { 'keydown' : function ( event ) { switch ( event . which ) { case 13 : case 32 : triggerAlternativeSelected ( event ) ; break ; case 37 : case 38 : self . trigger ( 'previousOption' , event ) ; event . preventDefault ( ) ; break ; case 39 : case 40 : self . trigger ( 'nextOption' , event ) ; event . preventDefault ( ) ; break ; } } } , 'focus' : function ( event ) { self . trigger ( 'focus' , event ) ; } , 'click' : triggerAlternativeSelected } ) ; this . $alternative . append ( $ ( '<div>' , { 'class' : 'h5p-sc-progressbar' } ) ) ; this . $alternative . append ( $ ( '<div>' , { 'class' : 'h5p-sc-label' , 'html' : this . options . text } ) ) ; this . $alternative . append ( $ ( '<div>' , { 'class' : 'h5p-sc-status' } ) ) ; }
@constructor
 @param {object} options Options for the alternative
@constructor @param { object } options Options for the alternative
// Enter // Space // Answer question // Left Arrow // Up Arrow // Go to previous Option // Right Arrow // Down Arrow // Go to next Option