I am wondering which path will end faster by selecting the elements:
$('element[href=#my_link]');
or
$('element.my_class');
I donβt like to repeat myself when I write code, so I prefer to write it in the first way for the most part, because then I can add information to it, for example:
<a href="#delete_1">Delete</a> $('a[href^=#delete]');
and then separate it so that I have all the information I need after clicking it or whatever it is. Because of this, am I sacrificing overall efficiency?
(I think I could rewrite it as class = "delete" href = "# 1")
source share