Greetings to all! There was a question, so I decided to get an opinion. I have this code, everything works as I need, but I just can’t figure out how to make each div div have 1 array from the global array. That is, in container_1 - Store [0] [j], in container_2 - Store [0] [j]. The value of j will be constant in each block from 0 to 5. I rummaged through a bunch of documentation, but I can’t find any pickups. Tell me if it is possible to do it at all and possible method, function. Bulkheads work fine, but all information sent to the form is also cloned (Thank you in advance!
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> <script> var Store = [["1","2","3","4","5","6"],["11","12","13","14","15","16"],["17","18","19","20","21","22"]]; var Sum = Store.length; </script> <script> $(document).ready(function() { var cl = 1; for(var pr = 1; pr < Sum; pr++) { var clone = $("#container").clone(false) var cloneItems = clone.find("*[id]").andSelf(); cloneItems.each(function() { $(this).attr("id", $(this).attr("id") + "_" + cl); }); clone.appendTo( ".clone-box" ); cl++; }}); </script> <div id="container"> <div id="G">1</div> <div id="A">2</div> <div id="S">3</div> <div id="Y">4</div> <div id="F">5</div> <div id="P">6</div><br> </div> <div class="clone-box"></div>
container_1andcontainer_2? - mixid="container",id="container_1"andcontainer_2be 1-6, 11-16 and 17-22, respectively? - mix1? herefor(var pr = 1; pr < Sum; pr++) {? - Grundy