I am new to javascript/jquery:
If i have a lot of links - how can i select specific ones. For example if i have 1000 links, each consisting of hrefs and link text - and i want to select 5 specific links, what is the easiest way to do this ?
My current solution is like so:
var firstLink = $('.link_list a').filter(function() {
return $(this).text() === "Link One Text"; });
});
var secondLink = $('.link_list a').filter(function() {
return $(this).text() === "Link Two Text"; });
});
This is keeping in mind, I want to only select specific links, see Select link by text (exact match).
This seems a bit messy to have a lot of variables defined using the same filter function over and over. Any other ideas ?