请看一下这个jsFiddle。基于单击,将附加类添加到 div。我正在尝试根据课程点击并获得回复。非常感谢您的帮助!
jQuery(document).ready(function () {
var count = 0;
$("#more_time").click(function () {
count += 1;
$("#list_times").append($("#more_time").text() + " - <span id='remove_" + count + "' class='remove' style='cursor:pointer; '>(remove)</span><br>");
});
$(".remove").on("click", function () {
alert("Hello");
});
});
html
<div id="more_time">Weekdays 7:00am - 9:00am - More Time</div>
<br>
<br>
<div id="list_times"></div>