snipt

Ctrl+h for KB shortcuts

JavaScript

Create array with lines from a textarea

var myArray = formName.textareaName.val.split("\n");
https://snipt.net/embed/db5e52ff8de445031dd8e8dbd0a927ba/
/raw/db5e52ff8de445031dd8e8dbd0a927ba/
db5e52ff8de445031dd8e8dbd0a927ba
js
JavaScript
1
2019-07-17T04:23:57
True
False
False
/api/public/snipt/6700/
create-array-with-lines-from-a-textarea
<table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><a href="#L-1">1</a></pre></div></td><td class="code"><div class="highlight"><pre><span></span><span id="L-1"><a name="L-1"></a><span class="kd">var</span> <span class="nx">myArray</span> <span class="o">=</span> <span class="nx">formName</span><span class="p">.</span><span class="nx">textareaName</span><span class="p">.</span><span class="nx">val</span><span class="p">.</span><span class="nx">split</span><span class="p">(</span><span class="s2">&quot;\n&quot;</span><span class="p">);</span> </span></pre></div> </td></tr></table>
array, split, textarea