How can I add the same element (with the same id) by clicking a button that has javascript attached on onclick() (I have no JS at the moment)? I thought about using document.write and then just add a div, but didn't work out for me + I've heard it's a bad practice.
So far what I have:
HTML:
<!DOCTYPE html/>
<html>
<head>
<title>wat</title>
<meta charset= "UTF-8">
<link rel="stylesheet" type="text/css" href="CssHtmlLapai.css">
<script src="JsLapai.js"></script>
</head>
<body>
<button type="button" onclick="NewDiv()">Click me</button>
<div id="first"></div>
</body>
</html>
CSS:
#first{
width: 100px;
height: 100px;
background-color: red;
}