发布于 2019-04-25 06:28:12
您可以尝试以下代码:
// find elements
var box = $("#banner-message")
// handle click and add class
$('#add').on("click", function(){
box.append("<p>Some text <button class='text-more'>x</button></p>")
})
$("body").on('click', '.text-more', function(){
$(this).parent().remove()
}) https://stackoverflow.com/questions/55842839
复制相似问题