たとえば、次のように入力すると、
私は画家です
皆さんこんにちは
La La La
入力して送信すると、次のように変換されます:
私は絵描きです
皆さんこんにちは
ラララ
<code class="language-js"><span class="kd">var</span> <span class="nx">val</span> <span class="o">=</span> <span class="nb">document</span><span class="p">.</span><span class="nx">getElementsByTagName</span><span class="p">(</span><span class="s1">'textarea'</span><span class="p">)[</span><span class="mi">0</span><span class="p">].</span><span class="nx">value</span><span class="p">;</span> <span class="nx">val</span> <span class="o">=</span> <span class="nx">val</span><span class="p">.</span><span class="nx">replace</span><span class="p">(</span><span class="s2">"\n"</span><span class="p">,</span><span class="s2">"</p><p>"</span><span class="p">);</span> <span class="nx">val</span> <span class="o">=</span> <span class="s2">"<p>"</span> <span class="o">+</span> <span class="nx">val</span> <span class="o">+</span> <span class="s2">"</p>"</span><span class="p">;</span> </code>