title: copy form data to clipboard
body: <p>So I have a list of items, on html page, in fact in form, something like this:</p>
  <p>ITEM 1 - ID - &quot;checkbox&quot; &quot;number box&quot;</p>
  <p>ITEM 2 - ID - &quot;checkbox&quot; &quot;number box&quot;</p>
  <p>I have around 400 items like this, and I found a code to copy selected items (where checkbox is selected) to clipboard and paste them where I want. But I can't make it work with quantity. So basicaly what I would like to achieve is to copy selected items with quantity to clipboard.
  Can someone please help me about this problem?</p>
  <pre><code>&lt;input type=&quot;button&quot; id=&quot;prikaz&quot; value=&quot;show&quot; onclick=&quot;displayMaterial();&quot; /&gt; button for the script
  
  &lt;form id=&quot;myFrm&quot; name=&quot;myFrm&quot;&gt; - form id
  
  &lt;div id=&quot;materialValues&quot;&gt;&lt;/div&gt; - this shows the selected item, where you can copy it
  
  &lt;ul id=&quot;myUL&quot;&gt; - ignore this this is just how i made a list
  
  
  &lt;li&gt;&lt;span class=&quot;item&quot;&gt;&lt;div class=&quot;&quot;&gt;&lt;table&gt;&lt;tr&gt;    &lt;td&gt;    ARC 4012718 P2-HD-RXR-SA    &lt;/td&gt;   &lt;td&gt;    160771  &lt;/td&gt;   &lt;td&gt;    &lt;input type=&quot;checkbox&quot; id=&quot; 160771  &quot; name=&quot;    160771  &quot; value=&quot;   160771 | ARC 4012718 P2-HD-RXR-SA   &quot;&gt;  &lt;/td&gt;   &lt;/tr&gt;&lt;/table&gt;&lt;/div&gt;&lt;/span&gt;&lt;/li&gt;
  
  this is just one item from my list
  
  &lt;/ul&gt;
  
  and the code: (this is not my code, i found it somewhere and it works for this purpose, but I woud like to add quantity as well, but I don't have enaught knowledge to place part of the script that would handle that, somwhere around tha IF selected part.
  
  &lt;script type=&quot;text/javascript&quot;&gt;
  function displayMaterial()
  {
  var str = '';
  var elem = document.getElementById('myFrm').elements;
  
  for(var i = 0; i &lt; elem.length; i++)
  {
  if(elem[i].checked)
    str += elem[i].value +&quot;&lt;br&gt;&quot;;
  }
  
  document.getElementById('materialValues').innerHTML = str;
  }
  
  
  &lt;/script&gt;
  </code></pre>