Event listener for input field in Tag Manager


I want to track the user input of a HTML input element with the Tag Manager.

So far, i created a new custom HTML tag with the content

<script type="text/javascript">
var input = document.getElementById('my-search-input');
input.addEventListener("input", (event) => console.log(event));

and i also added a DOM Ready trigger.
When i load my page, i can see that the trigger is getting fired and the script is added to the page. But the event listener for the input element is never fired.
What do i have to do to add an event listener via the Tag Manager?

Thanks a lot and regards