title: Combining multiple audio click JS functions into one?
body: <p>So i found a script and modified to it to work with what I need. But i need to do one more thing and not sure where to start with it. </p>
  
  <p>Here is the code im using to get two different audio files to play with two different buttons</p>
  
  <pre><code>        $(document).on("click", "li", function(event) {
              var audioElement = document.createElement('audio');
              audioElement.setAttribute('src', 'http://www.uscis.gov/files/nativedocuments/Track%2093.mp3');
  
              //audioElement.load()
              $.get();
              audioElement.addEventListener("load", function(event) {
              audioElement.play();
              }, true);
  
              $('.play-duck-1').click(function(event) {
              audioElement.play();
              });
          });
  
              $(document).on("click", "li", function(event) {
              var audioElement = document.createElement('audio');
              audioElement.setAttribute('src', 'http://sandbox.acscreative.com/cort-aminals/sounds/new-recording.m4a');
  
              //audioElement.load()
              $.get();
              audioElement.addEventListener("load", function(event) {
              audioElement.play();
              }, true);
  
              $('.play-duck-2').click(function(event) {
              audioElement.play();
              });
          });
  </code></pre>
  
  <p>is there a way to combine these scripts so I don't have to copy and paste this 36 times for 36 different audio files and buttons?</p>
  
  <p>I have seen lots of "function combining" post but none that look like they would work me for unless im overlooking something.</p>
  
  <p>Thanks for the help</p>