<form>
<button type="submit">Go</button>
<button class="add">Добавить</button>
</form>
<ul class="list"></ul>
let index = 0;
let list = $(".list");
$("form").bind("submit", event => { // bind!!!
event.preventDefault();
list.find("li").each(item => {
alert(item);
});
});
$(".add").on("click", event => {
event.preventDefault();
const li = document.createElement("li");
li.textContent = index++;
list.append(li);
})