js插入html代码

点击button,例如:


<button>按钮</button>


添加 <button class="condition-btn">按钮</button>



<div id="chart-body" class="chart-body"></div> 中


该如何写?


红糖糍粑
浏览 1145回答 1
1回答

ITMISS

$("button").click(function(){&nbsp; &nbsp; &nbsp;$("#chart-body").append("<button class='condition-btn'></button>");&nbsp; &nbsp; &nbsp;var btnText = $("button").text();&nbsp; &nbsp; &nbsp;$(".condition-btn").text(btnText);})
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript