jQuery does not execute on dynamically loaded content,, even on a click events.

Posted by sxv on Stack Overflow See other posts from Stack Overflow or by sxv
Published on 2011-02-10T07:22:54Z Indexed on 2011/02/10 7:25 UTC
Read the original article Hit count: 131

Filed under:
|
|
|

I have two document.ready functions. The first loads content into div#header. The second one performs a hide function and then a toggle function on the newly loaded content. I am not sure if this is a queueing issue or something, but not even the alert() below is executed when I click the loaded content. Thanks.

<script type="text/javascript">
$(document).ready(function() {
     $("#header").load("/documents/collegeradioheader.txt");
});
</script>
<script type="text/javascript">
 $(document).ready(function() {
    $(".hideme").hide(); 
    $(".slick-toggle").click(function() {
        alert('hi');
        $(this).parent().next('div').slideToggle('fast');
        .siblings('div:visible').slideUp('fast');           
    });
});
</script>

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dom