title: Click event on Button INSIDE table
body: <p>How to open Modal Dialog from when I click on Button inside table?</p>
  
  <pre><code>function GetAllCountries() {
  
      $('#update_panel').html('Loading Date....');
      $('#update_panel').html("&lt;img src='/Pic/ajax-loader.gif'/&gt;")
      $.ajax({
          url: '/Home/GetCountries',
          type: 'GET',
          datatype: 'Json',
          success: function (data) {
              if (data.length &gt; 0) {
                  var $data = $('&lt;table id="tableItems"&gt; &lt;/table&gt;').addClass('table table-responsive table-striped');
                  var header = "&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Country ID&lt;/th&gt;&lt;th&gt;Country&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;";
                  $data.append(header);
  
                  $.each(data, function (i, row) {
                      var $row = $('&lt;tr/&gt;');
                      $row.append($('&lt;td/&gt;').html(row.CountryId));
                      $row.append($('&lt;td/&gt;').html(row.CountryName));
  
                      $row.append($('&lt;td/&gt;').html("&lt;button class='A' id='mybtn'&gt;Edit&lt;/button&gt;"));
  
                      $data.append($row);
                  });
  
                  $('#update_panel').html($data);
              }
              else {
                  var $noData = $('&lt;div/&gt;').html('No Data Found!');
                  $('#update_panel').html($noData);
              }
          },
          error: function () {
              alert('Error! Please try again.');
          }
      });
  }
  </code></pre>
  
  <p>I tried the following code but didn't work</p>
  
  <pre><code>$("#mybtn").click(function () {
          $("#CreateForm").dialog({
              autoOpen: false,
              modal: false,
              width: 500,
              height: 500,
          });
          $("#CreateForm").dialog('open');
      })
  </code></pre>
  
  <p>I think I need something like to reach the button INSIDE the table and add click event of it</p>
  
  <pre><code>$("#Table: Tbody,th,tr").click(function () {
          $("#CreateForm").dialog({
              autoOpen: false,
              modal: false,
              width: 500,
              height: 500,
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/xGuR3.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/xGuR3.jpg" alt="image"></a></p>