JSFiddle - React, Tailwind, and code Playground

HTML

<a href="http://example.com">Link 1</a>
<a href="http://example.com">Link 2</a>
<a href="http://yahoo.com">Link 3</a>
<a href="http://gmail.com">Link 4</a>
<a href="http://example.com">Link 5</a>
<br/><br/>
<input type="button" id="btn" style="cursor:pointer;" value="get links with href = example.com"/>
<br/><br/>
<div id="result"></div>

JavaScript

$(document).ready(function(){

    $('#btn').click(function(){
        elems = $('a[href*="example.com"]');
        $('#result').html(elems.text() + " have 'example.com' value in href attribute");
    });
    
});