Play sound if correct/incorrect

by ian_smithz

HTML

<button class="cell" data-ans="false">Incorrect</button>

<button class="cell" data-ans="true">Correct</button>

JavaScript

$(".cell").click(function() {

  if ($(this).attr('data-ans') == 'false') {

    var incorrectSound = new Audio('http://www.sounddogs.com/previews/2185/mp3/100811_SOUNDDOGS__an.mp3');
    incorrectSound.play();
  } else {

    var correctSound = new Audio('http://www.sounddogs.com/previews/25/mp3/381100_SOUNDDOGS__bi.mp3');
    correctSound.play();
  }

})