I get the id of a li that was clicked like this:
$("#repository-tabs li").on("click", function(e) {
alert(this.id);
});
Easy, problem is, I add li elements dynamically afterwards:
$("#add-tab").click(function() {
tabs = $("#repository-tabs li").length - 1;
append_at = tabs - 2;
$("#repository-tabs li:eq(" + append_at + ")").after('<li id="repository-tab-' + tabs + '" class="tab col s3 z-depth-5"><a class="white green-text text-darken-2 waves-effect waves-light" href="javascript:void(0);">Repositório ' + tabs + '</a></li>');
});
Now, when I click the added li elements, no event is triggered. So, how can I get the ID of a future clicked item?