Entonces tengo una lista de elementos, en la página html, de hecho en forma, algo como esto:
ARTÍCULO 1 - ID - "casilla de verificación" "casilla de número"
ARTÍCULO 2 - ID - "casilla de verificación" "casilla de número"
Tengo alrededor de 400 elementos como este, y encontré un código para copiar los elementos seleccionados (donde la casilla de verificación está seleccionada) al portapapeles y pegarlos donde quiero. Pero no puedo hacer que funcione con la cantidad. Entonces, básicamente, lo que me gustaría lograr es copiar los elementos seleccionados con la cantidad al portapapeles. ¿Puede alguien por favor ayudarme con este problema?
<input type="button" id="prikaz" value="show" onclick="displayMaterial();" /> button for the script <form id="myFrm" name="myFrm"> - form id <div id="materialValues"></div> - this shows the selected item, where you can copy it <ul id="myUL"> - ignore this this is just how i made a list <li><span class="item"><div class=""><table><tr> <td> ARC 4012718 P2-HD-RXR-SA </td> <td> 160771 </td> <td> <input type="checkbox" id=" 160771 " name=" 160771 " value=" 160771 | ARC 4012718 P2-HD-RXR-SA "> </td> </tr></table></div></span></li> this is just one item from my list </ul> 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. <script type="text/javascript"> function displayMaterial() { var str = ''; var elem = document.getElementById('myFrm').elements; for(var i = 0; i < elem.length; i++) { if(elem[i].checked) str += elem[i].value +"<br>"; } document.getElementById('materialValues').innerHTML = str; } </script>