I would like to click in the words that is in the array with texts and sounds.
I took the code from this link: Detect which word has been clicked on within a text, but I don't know how to figure out a way to click in the word and listen its sound using jquery
<script>
var wordaudio = [];
wordaudio["Lorem"] = "lorem.mp3";
wordaudio["ipsum"] = "ipsum.mp3";
wordaudio["dolor"] = "dolor.mp3";
$("body").click(function(){
var s = window.getSelection();
s.modify('extend','backward','word');
var b = s.toString();
s.modify('extend','forward','word');
var a = s.toString();
s.modify('move','forward','character');
// alert(b+a);
document.getElementById('myAudio').src='0001.mp3';
document.getElementById('myAudio').play();
});
</script>
<p>Lorem ipsum dolor sit amet.</p>
<audio id="myAudio" src=""></audio>