I have this code
$(".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"); } });
Which returns me some html form without a close button
I want to add a close button using this method without adding it to every single function
$('*[class*="_drop"]').change(function() { $(this).append($('<a />', { class: 'close-drop', click: function(e) { e.preventDefault(); alert("test"); }}) ); });
But nothing happens - I do not understand why the close button does not add
<div class="test_wrap relative"> <div class="test_drop absolute"></div> </div>
Example: http://jsfiddle.net/fppfyey7/10/
javascript jquery
xoxn-- 1'w3k4n Nov 23 '15 at 16:13 2015-11-23 16:13
source share