Element class seems the best way to query the element from DOM in js code. Other variants like it's relative possition to other elements are very fragile. Let's say that we have the following DOM:
<a> Delete</a> <a> Edit</a>
- By order(first, second) will cause problems if designer would like to change the order.
- By id will fail if you would have a list of elements where each has these links
- By label is just a fuck up and won't work for multi language application
<a class="js-new-comment big-blue-button"> New Comment </a>
Yes, sometimes it may look like:
But that makes sense to eliminate maintenance problem described above.
<input type='button' class="js-follow-button follow-button"> Follow this person </input>