Hello, I’m more familiar with JavaScript than I am with PHP. That’s the reason for the framing in the title. I’m working on a WordPress site. As far as I can tell, it doesn’t really have any XML which I see several tutorials reference. So, what I would like to know is how to select an HTML element by its id and then echo the result without referencing any XML. Thank you.
That's not how php works - it just spits out text that happens to be html. You need to find the point in the template that generates the text that needs to change and edit it. You can't just tack code onto the end and expect it to change what's already been generated.
To be honest, I can not understand why document.getElementById is not suitable for you. It should find your element in the HTML. You don't need XML. Maybe, there is a mistake in your code.
The problem is that PHP is processed before the page is loaded. JavaScript functions can be called via events after the page has been loaded. Use PHP to build the HTML and JavaScript to manipulate it.