$('#next').click(function() { var key = Math.floor(Math.random()*1000); var nam = Math.floor(Math.random()*1000); var p1 = $('<div class ="m1">'+ key +'</div>'); var p2 = $('<div class ="m2">'+ nam +'</div>'); $('<div class ="block"></div>').prependTo('#blocks'); $(p1).attr('id', key).prependTo('.block'); $(p2).attr('name', nam).prependTo('.block'); }); #blocks { float: left; } .block { width: 600px; height: 40px; margin-bottom: 10px; border-radius: 10px; text-align: center; background: white; } .m1, .m2 { width:100px; height:20px; float:left; border:1px solid #000; margin:10px 10px 10px 10px; border-radius: 10px; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <button id='next'>More</button> <div id="blocks"></div> Hello. It’s impossible to dynamically add a div with 2 more divs Dynamically from the database I get values in key and nam and I want to add a div with them, inside which there is a div with the value key and a div with the value nam
I want on the same line to add one div inside with two divas with key and nam
Никак не получается добавитьandВсе криво получается? Concrete. Need specifics ..... - Alexey Shimansky