JSFiddle - React, Tailwind, and code Playground
by Liaqat Saeed
HTML
<script src="https://code.jquery.com/jquery-3.2.1.js"></script>
<div class="appendDiv">
</div>
<button class="abc">
Click me
</button>
CSS
.appendDivChild{
width:400px;
height:400px;
margin:10px;
}
.appendDiv{
background-color:red;
}
JavaScript
function hello(){
for(i=0;i < 10; i++){debugger;
$randHex = '#'+(Math.random()*0xFFFFFF<<0).toString(16);
if($randHex.length < 7)
{
$randHex = $randHex + i;
}
$that = $('.appendDiv');
$that.append("<div style='background-color:"+$randHex+"' class='appendDivChild'></div>")
}
}
$('.abc').click(function(){debugger;
hello();
});