Javascript appendChild() not working.
问题 I am at a loss as to why the following is not working. HTML: ... <div class="col2"> <h2>Your Groups</h2> <input type="submit" id="addnew" class="btn btn-primary" value="Create New Group"/> <div id="parent"> <!--new div here--> </div> </div> ... Javascript: document.getElementById('addnew').onclick = function(){ var parent = document.getElementById('parent'); var newGroup = document.createElement("div"); newGroup.setAttribute("id", "newGroup"); newGroup.setAttribute("class", "inner"); parent