Creating a WebButton at runtime

Webcore works really well with HTML templates using the elementID of a control.


However I cannot work out how to create a WebButton when the form is created and get this linking via elementID to work. Should this work? Am I doing something wrong?

During runtime creation, in the constructor specify the ID of the HTML element it should link to.
I.e. when the HTML element ID is 'btn', use:


var
  wb: TWebButton;
begin
  wb := TWebButton.Create('btn');
  wb.Parent := Self;
  wb.OnClick := ButtonClick;
end;