I'm just starting out with jquery. Already learned some things and like it, but I have been struggling with the following issue for a few days.
I copied the "dialog-confirm"-function from <https://jqueryui.com/>. I placed this script between the tags on my index.php page.

```
<script type = "text/javascript">

$(document).ready(function(){

    $(function() {
    $( "#dialog-confirm" ).dialog({
        resizable: false,
        height:140,
        modal: true,
        buttons: {
            "Delete all items": function() {
                $( this ).dialog( "close" );
                },
                Cancel: function() {
                $( this ).dialog( "close" );
            }
        }
    });
  });

  $(window).resize(function() {
      $('#scrollpage').height($(window).height() - 250);
  });
  $(window).trigger('resize');

    $('.container').on('click', '.mainmenu', function(event){
      event.preventDefault();

        var url = $(this).attr('href');
        $.get(url, function(data) {
          //alert(data);
          $("#div1").load(url);
        });

        $( this ).parent().addClass('current_page_item');
      $( this ).parent().siblings().removeClass('current_page_item');
  });

  $('.container').on('click', '.rapport', function(event){
      event.preventDefault();
        //$(".dialog-confirm").dialog( "open" );

        var url = $(this).attr('href');
        $.get(url, function(data) {
        //alert(data);
        $("#div1").load(url);
      });
  });
});

</script>

```

If i place the matching div in the same index.php page. It works fine, the div pops up.

```
<div id="dialog-confirm" title="Empty the recycle bin?">
  <p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>Blablabla</p>
</div>

```

However when i place the div in a page which is loaded by ajax in the div1, then I cant get it to work.

```
<div class="scrollpage" id="scrollpage">
  <div class="container" class="page" id="div1">

  </div>
</div>

```

Can anyone explain to me why this is, and how I can fix this?