Why are the inputs created by JavaScript in this very simple code appearing below the div instead of inside it?
HTML:
<div id="magicButtonDiv">
<p>I am filler text</p>
</div>
JavaScript:
function makeButton() //Activated when a button in another part of the page is pressed
{
var text = "";
text += "<p>What is your gender?</p>";
text += "<input type='button' class='genderButton' value='male' onClick='maleFunction'/>";
text += "<input type='button' class='genderButton' value='female' onClick='femaleFunction'/>";
document.getElementById("magicButtonDiv").innerHTML=text;
}
CSS:
#magicButtonDiv
{
box-sizing : border-box;
-moz-box-sizing : border-box;
-webkit-box-sizing : border-box;
border : 1px solid #000000;
}
input.genderButton
{
float. : left;
margin-left : 2%;
width : 47%;
}
There's more code, but I think the error is somewhere in this part of the code.