Use the delegated format of the on method…
- $(function() {
- $("#nm").keypress(function(e) {
- if (e.keyCode === 13) {
- $(".res").append("<p class=\"fd\">" + $(this).val() + "</p>");
- $(this).val("");
- }
- });
- });
- $(document).on("click", ".fd", function(e) {
- $(this).remove();
- });
JΛ̊KE