加载后附加元素

我有这个代码

$(".test_init").click( function(){ var win = $(this).next(".test_wrap").find(".test_drop"); if ($(win).html().length) $(win).empty().hide("fast"); else { $(win).load("URL"); } }); 

这给我一些没有关闭按钮的html表单

我希望使用这种方法添加关闭按钮,而不是在每个单独的函数中添加它

 $('*[class*="_drop"]').change(function() { $(this).append($('', { class: 'close-drop', click: function(e) { e.preventDefault(); alert("test"); }}) ); }); 

但没有任何反应 – 我无法理解为什么关闭按钮不会附加

 

示例: http : //jsfiddle.net/fppfyey7/10/