Same applies for me = not sure I understand the question.
But in principle for using GetElementById, create a B4J Server App with a WebSocket. GetElementById is described here, for that.
An example project download here = WebApp adding a button Dynamically.
You do not need Apache to be setup on the Raspberry Pi, as B4J Servers run autarkic = just run java -jar yourapp.jar, then access via browser with HostAddress : Port. In the latest Raspian versions, Java is by default installed.
B4J Server Apps run very well on Raspberry Pi's (based on my experience so far with several apps running for monthes on various Pi's)