JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.0/jquery.js"></script>
<script src="https://maps.google.com/maps/api/js?sensor=false"></script>
<table class="table">
<tbody></tbody>
</table>
<button class="btn-primary">Add Row
</button>
JavaScript
function ae(event) {
console.log('clicked id: ', event.target.id);
var items = JSON.parse(localStorage.getItem('entry'));
if (typeof items !== 'object') {
items = [];
}
var entry = {
'num': event.target.id
};
items.push(entry);
localStorage.setItem('entry', JSON.stringify(items));
alert(localStorage.getItem('entry'));
}
$(document).ready(function() {
$(document).on('click','.invite',ae);
$(document).on('click', '.btn-primary', function() {
var num = Math.random();
$('.table tbody').append('<tr class="child"><td>one</td><td><button id="' + num + '"type="button" class="invite ">Invite</button></td></tr>');
});
});