Click a button programmatically in Safari Extension not working

I am trying to click a button programmatically using JavaScript. It is working in macOS Safari, but it doesn't work in iOS Safari. The document.getElementById("buttonid") returns the button, but when I click it, it doesn't do anything. I've spent a lot of time researching what could be the problem, but I couldn't find any solution. I assume it is somehow blocked on iOS. Here is my code for clicking a button:

document.getElementById("buttonid").click();

Does anyone know what could be the problem? Thanks in advance

Click a button programmatically in Safari Extension not working
 
 
Q