Hellow everyone,
I can't figure out why the onClick event is not working. I have tried to put the script in the head tag, in a separate js file, tried to use jQuery to perform the action ... nothing has worked.
I would greatly appreciate it if somebody with more experience could please explain what could be the problem with the code below.
Thank you in advance for your time!
<!DOCTYPE html>
<html>
<body>
<span class="position">Text to be changed when Facbook Icon is clicked</span>
<ul class="social">
<li><span onclick="alert()"><i class="icon-facebook2"></i></span></li>
<li><i class="icon-instagram"></i></li>
<li><i class="icon-github"></i></li>
<li><i class="icon-linkedin2"></i></li>
</ul>
<script type="text/javascript">
function alert(){
document.getElementsByClassName("position").innerHTML = "Text is now changed";
};
</script>
</body>
</html>