Dynamically using Ajax I created a table, but it was necessary that when I clicked on an ID, a pop-up appeared with detailed information
$(function() { var output = $('table tbody'); $.ajax({ url: 'http://cm.mmi.macc.com.ua/tests/sample.php', type: 'GET', dataType: 'json', success: function(data) { var rows = ''; $.each(data, function(i, el) { rows += `<tr> <td>` + el.id + `</td> <td>` + el.name + `</td> <td>` + el.author + `</td> <td>` + el.date + `</td> <td>` + el.number + `</td> <tr> `; }); output.html(rows); } }); }); h2 { text-align: left; } table { border-collapse: collapse; width: 100%; max-width: 750px; margin: 0 auto; } td, th { padding: 3px 5px; border: 1px solid #999; text-align: center; } th { background-color: #ccc; } hr { height: 1px; border: none; background-color: black; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <div class="container"> <div class="row"> <div class="col-md-8 col-md-offset-2 text-center"> <h2>Demo Application Title</h2> <hr> <table> <thead> <th>ID</th> <th>Название</th> <th>Автор</th> <th>Дата выпуска</th> <th>Серийный номер</th> </thead> <tbody></tbody> </table> </div> </div> </div> How to implement it? I tried it like this, for example:
output.on('click', 'tr td:first-child', function() { alert($(this).text()); }); but the console swears
