While working on client’s project, I was required to select <a> tag element by its URL i.e value of href attribute. Thanks to jQuery, I was able to perform this task very easily. Here’s the code which allows you to select <a> element by href.
var link = $('a[href="http://coffeecupweb.com"]');
The above code will select <a> element with http://coffeecupweb.com. You can also select links starting with a certain URL using attributeStartsWith selector.
var links = $('a[href^="http://coffeecupweb.com"]');