First of all, this requires JavaScript. Any time you want a click to do something more than load a new page, you're going to be dealing with JS.
Secondly, putting JS directly in your HTML is poor security practice. So something like href="removeItem({{item.id}})"
will mean you cannot use a Content Security Policy and will thus mean you need to take extra steps to avoid injection and cross-site scripting attacks. You should be sure you're using a CSP so you know exactly what's running on your site.
Thirdly, links are for going to other pages, not for doing things on the current page. It's best to use a div or a button for that sort of action, otherwise you have to take other steps to suppress the link behavior. (You will need to do some CSS styling to get the div to look clickable.)
The right solution is to put the JS in a separate file and then add a handler on the link in question. You code would look something like this:
js/items.js
// Runs on page load
$(function() {
$('.delete-item').on('click.myitems', confirmDeleteItem);
$('.edit-item').on('click.myitems', editItem);
});
function editItem(e) {
let item_id = parseInt($(e.target).closest('tr').attr('data-item-id'), 10);
// Do something with your item ID.
}
function confirmDeleteItem(e) {
let item_id = parseInt($(e.target).closest('tr').attr('data-item-id'), 10);
if (confirm('Do you really want to delete "' + item_id + '"?')) {
// Do it!
}
}
items.html (Jinja template)
{% for item in person_list %}
<tr data-item-id="{{item.id}}">
<div class="delete-item">Delete</div>
<div class="edit-item">Edit</div>
</tr>
{% endfor %}
<script src="{{ url_for('static', filename='js/items.js') }}"></script>