html viewer click button using id

Does anyone know how to click a button using ID

Something like this I assume?

HTMLViewer1.ExecuteJavaScript(“document.forms[0].elements[‘buttonid’].click;”)

but it doesn’t work.

And depending on the action taken by that click, it wouldn’t. There are certain actions that you can’t script (like downloads), but if what you are trying to do is Submit a form, try

document.forms[0].submit();

Hi Greg,

I haven’t tried that but all I had to do was add () in front of ;

Thanks to @Wayne Golding