 <p>You should use the <a href="https://api.jquery.com/contains-selector/" rel="nofollow"><code>:contains()</code> filter</a> instead of <a href="https://api.jquery.com/jQuery.contains/" rel="nofollow"><code>.contains()</code> method</a>. Also to add a link <em>after</em> the link, use <code>.after()</code> instead of <code>.append()</code> (which appends to innerHTML).</p> <pre><code>$(".links a:contains('append after me')").after("&lt;a href=''&gt;new link&lt;/a&gt;"); </code></pre>