{% if unicorn.errors.items %}
<script>
    function getId(modelName) {
        let element = $('[unicorn\\:model=' + modelName + ']');

        if (element && element.id) {
            console.log('element', element)
        }
    }
</script>

<div class="unicorn-errors">
    <ul>
        {% for name, errors in unicorn.errors.items %}
        {% for error in errors %}
        <li class="unicorn-errors-{{ error.code }}">{{ error.message }}</li>
        {% endfor %}
        {% endfor %}
    </ul>
</div>
{% endif %}