this must be simple to a lot of you guys, but I'm only starting learning javascript and tried to follow a lot of tutorials and none worked.
I'm building a site using Wordpress and can't add javascript natively on menu links, so I added a class to identify the link and add a function externally, my last attempt was the following code:
<a class="radioPlayerLink" href="#">Listen do the radio player</a>
And tried to add javascript with the following script:
<script>
var radioPlayer = document.getElementByClassName("radioPlayerLink");
radioPlayer.addEventListener("click", abrirPlayer);
function abrirPlayer(){
window.open('https://portalrdx.com.br/player-rdx.html', 'aio_radio_player', 'width=720, height=355'); return false;");
}
</script>
I'm not interested in Wordpress solutions, but on to making javascript works, be as explicative as you can to show where I got wrong (probably all of it).
Thank you :)