title: click event on jqueryui dialog
body: <p>I'm starting with jQuery and Jquery UI. Currently I have a problem with a modal dialog I've opened that contains elements from an ajax iTunes response: </p>
  
  <pre><code>$.ajax({
      url: $url,
      dataType: 'JSONP'
  }) 
  .done(function(data) {
    console.log(data);
    var cuadro_itunes = "&lt;table&gt;&lt;tr&gt;&lt;td&gt;Artista&lt;/td&gt;&lt;td&gt;Tema&lt;/td&gt;&lt;td&gt;Portada&lt;/td&gt;&lt;td&gt;Usar&lt;/td&gt;&lt;/tr&gt;";
    $.each(data.results, function(i) {
      cuadro_itunes = cuadro_itunes+"&lt;tr&gt;&lt;td&gt;"+
        data.results[i].artistName+"&lt;/td&gt;&lt;td&gt;"+
        data.results[i].trackName+"&lt;/td&gt;&lt;td&gt;"+
        "&lt;img class='itunes-imagen' id='"+i+"' src='"+data.results[i].artworkUrl100+"' /&gt;"+
        "&lt;input type='hidden' class='itunes-url' id='"+i+"' value='"+data.results[i].trackViewUrl+"' /&gt;&lt;/td&gt;&lt;td&gt;"+
        "&lt;input type='button' class='itunes-select' id='"+i+"' value='Seleccionar' /&gt;&lt;/td&gt;&lt;/tr&gt;";
    });
    cuadro_itunes = cuadro_itunes+"&lt;/table&gt;";
  
    $("#itunes-dialog").html( cuadro_itunes );
    $("#itunes-dialog").dialog("open");
  })
  .fail(function(data) {
    console.log(data);
  });
  </code></pre>
  
  <p>The point is that each row element has a input button tag. Now I want to catch whenever the input button is clicked to pass the selected values to the parent window:</p>
  
  <pre><code>$(".itunes-select").on("click", function() {
      $("#itunes-dialog").dialog("close");
      $("body").find(".enlace#"+window.busqueda_id).val( $("#itunes-dialog").find(".itunes-url#"+$(this).attr("id")).val() );
      $("body").find(".portada#"+window.busqueda_id).val( $("#itunes-dialog").find(".itunes-imagen#"+$(this).attr("id")).val() );
    });
  </code></pre>
  
  <p>But the click event is never triggered. Can anyone help me?</p>