I try to simulate click on a link with javascript
here is the code:
document.getElementsByClassName('link-a')[2].click();
When i try this
document.getElementsByClassName('link-a')[2];
I have the link that ai want to simulate a click but when i add the click() function it's return undefined and there is no click at all...
can you help me please?
Thank you for your help
so
document.getElementsByClassName('link-a')[2];
gives you back an HTML element.
and you can call "click()" on it, because click is a method it provides.
click does return undefined (as expected)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With