 <p>Not really anything to do with jQuery, but if you want to trim a pattern from a string, then use a regular expression:</p> <pre><code>&lt;textarea id="ta0"&gt;&lt;/textarea&gt; &lt;button onclick=" var ta = document.getElementById('ta0'); var text = 'some&lt;br&gt;text&lt;br /&gt;to&lt;br/&gt;replace'; var re = /&lt;br *\/?&gt;/gi; ta.value = text.replace(re, '\n'); "&gt;Add stuff to text area&lt;/button&gt; </code></pre>