Hello.
Yuzayu MDL (getmdl.io), in particular, we are working with the table. The goal is to load an AJAX table with the possibility to select each of the positions. The checkboxes in this table are js made by the MDL library. Problem:
With this solution, JS does not process the table, that is, only styles are applied, without checkboxes. There are no problems with the loadable code, if you insert it directly into the original checkbox page, they work. In theory, you need to somehow force javascript to re-process a new piece of code obtained from ajax. How to solve this problem? Thank you in advance
function ShowGoods(distr) { console.log(distr); if (distr.classList.contains('checked')) distr.classList.remove('checked'); else { $.ajax({ url: '/core/interface/goods/showdistr.php', type: 'POST', dataType: 'html', data: { distributor: distr.value, city: 'spb' }, success: function(responce) { $('#add-goods').html(responce); }, error: function() { return 0; } }); } } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> <script src="https://code.getmdl.io/1.1.3/material.min.js"></script> <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:regular,bold,italic,thin,light,bolditalic,black,medium&lang=en"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://code.getmdl.io/1.1.3/material.indigo-pink.min.css"> <table class="mdl-data-table mdl-js-data-table mdl-data-table--selectable mdl-shadow--2dp"> <thead> <tr> <th class="mdl-data-table__cell--non-numeric">Material</th> <th>Quantity</th> <th>Unit price</th> </tr> </thead> <tbody id='add-goods'> <!-- рабочий код --> <tr> <td class="mdl-data-table__cell--numeric">1</td> <td>2</td> <td>3</td> </tr> </tbody> </table> <!-- пример подгружаемого кода: <tr> <td class=\"mdl-data-table__cell--numeric\">1</td> <td>2</td> <td>3</td> </tr> -->
Чекбоксы в этой таблице делаются js библиотекой MDLshould be done after the ajax-result is append to the page. - Jean-Claude