Enter spanish text:
<script> function speakSpanish() { var val = $('#spanishPhrase').val(); if (val) location="https://audio1.spanishdict.com/audio?detect_lang=true&text="+val.replace(/\s+/g, '-').toLowerCase()+"&format=mp3"; } $('#spanishPhrase').on('keypress', function (e) { if(e.which === 13){ //Disable textbox to prevent multiple submit $(this).attr("disabled", "disabled"); //Do Stuff, submit, etc.. //$("downloadLink").trigger("click"); window.open("https://audio1.spanishdict.com/audio?detect_lang=true&text="+$('#spanishPhrase').val().replace(/\s+/g, '-').toLowerCase()+"&format=mp3", "_blank"); //Enable the textbox again if needed. $(this).removeAttr("disabled"); } }); $('#spanishPhrase').on('input',function(e){ $("#downloadLink").attr("href", "https://audio1.spanishdict.com/audio?detect_lang=true&text="+$('#spanishPhrase').val().replace(/\s+/g, '-').toLowerCase()+"&format=mp3"); }); </script>