I am trying to click on a specific link through a submit button.
Basically I have a ul with a large amount of li's with a link of class="episodeLink" in each li as you can see on http://8animetv.co.vu/onepiece .
I have added an input box in which you write a number, press Watch and via a javascript function it's supposed to click on .episodeLink:nth-child(n).
I have written the javascript like this
<script type="text/javascript">
function openEpisode() {
var input = document.getElementById('input');
var allEpisode = $(".episodeLink").length + 1;
var click = allEpisode - input.value;
document.getElementsByClassName("episodeLink:eq('+click+')").click();
}
</script>
So when you write f.ex. 5 it will firstly grab the number 5, then count the amount of .episodeLink's there is and add 1 to that, so that you can substract the first number (5 in this example) and find which .episodeLink I have to select to get clicked. I have already tested the numbers with an alert(click); and it is the correct number every time.
I just need to know how do I call Javascript to click on .episodeLink:nth-child(click); ?