如何点击添加按钮时添加按钮
function getInsertBtn(){ //创建input元素 var inp = document.createElement("input"); inp.type = "button"; inp.addEventListener('click', function () { openLayerUrl('@Url.Action("PartialChildNodeView", "UEditor")');getBtnValue(this.value);printBtnValue() }) let addButtonLength = Number($('.addButton>input').length)+1; inp.value = "知识点" + addButtonLength; $(".addButton").append($(inp)) }
<div> <input style="float:left" id="zhenjiazhishi" type="button" name="jushouda" value="增加知识按钮" onclick="getInsertBtn()" /> </div>
<div class="addButton"> <input id="jichuzhishi" type="button" name="jushouda" value="知识点1" onclick="openLayerUrl('@Url.Action("PartialChildNodeView", "UEditor")');getBtnValue(this.value);printBtnValue()" /> </div>