Note that there are some explanatory texts on larger screens.

plurals
  1. POjQuery appended element function
    primarykey
    data
    text
    <p>Can someone tell me why the declared function does not apply to the elements created by append() method? It does work fine with the element but, when another element is aded using the mentioned function, the action does not fire?</p> <p>The info_box var containg div closes using the function <code>$(".notification-close").click(function(){</code> but when the box is created using the append() method, it does not work anymore.</p> <pre><code> $(document).ready(function () { //setTimeout(function(){$(".notification-box").fadeOut("slow");}, 6000); $(".notification-close").click(function(){ $(".notification-box").fadeOut("slow");return false; }); // AJAX $(".lightbox_delete_button").easyconfirm({locale: { title: 'Delete', button: ['No','Yes']}}); $(".lightbox_delete_button").click(function () { var pictid_lightbox = $(this).parent().find('#pictid_lightbox').val(); var thumb_container = $(this).parents('.thumb_container'); var tools_counter = $('body').find('#tools_lightbox_count').text(); var reduced_tools_counter = parseInt(tools_counter)-1; var info_box = "&lt;div class=\"notification-box notification-box-info\"&gt;&lt;p&gt;You don't have any images in your lightbox&lt;/p&gt;&lt;a href=\"#\" class=\"notification-close notification-close-info\"&gt;x&lt;/a&gt;&lt;/div&gt;"; $.ajax({ url: "ajax.html", type: "POST", async:false, data: ({f:"test_ajax",pictid_lightbox:pictid_lightbox}), success: function(data){ alert(data); thumb_container.fadeOut("slow"); $($('body').find('#tools_lightbox_count')).replaceWith('&lt;span id=\"tools_lightbox_count\"&gt;' + reduced_tools_counter.toString() + '&lt;/span&gt;'); if(reduced_tools_counter == 0){ $('body').find('#center_column').append(info_box); }else{ alert('not empty'); } } }); return false; }); }); </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload