Upon page load, the function is executed regardless of whether the button has been clicked or not. It's important to note that I am utilizing EJS.
I experimented with changing the <%
tag to <%=
and <%-
, and also attempted using an arrow function:
<% () => Delt(this.id);%>
.
<%function Delt() { Array.pop(); }%>
<button onclick="<%Delt(this.id);%>">Delete</button>