Good day. How to attach click events to link number 2, when the first link is dynamic, that is, it appears and disappears randomly.
This script should work with DOM, there is no possibility to work with the code.
<div class="a"> <a class="href" href="#">1</a> //Рандомная ссылка <a class="href" href="#">2</a> <a class="href" href="#">3</a> </div> var el = document.getElementsByClassName('href')[0]; el.click(); I would count the number of links. If there are one more links, he fulfilled the if condition, added one to zero. But there are cases when there are much more links, and I need to bind the event to a specific link.
<a class="flhdr selectme" ...- Igor