SetElementAttributeById
Interface AntViewDocument
Type: Method
Parameters: String Id String AttrName String Value
Returns: nothing
Set the Value of the attribute for the html element in the document currently loaded in the WebView2 component.
The html element is identified by parameter Id.
Note that the id is case sensitive and must match the case of the html element.
The attribute is passed via parameter AttrName.
This triggers the OnSetElementAttributeById event on completion as it is an asynchronous operation.
Example in Visual FoxPro:
LOCAL lbIsSuccess
LOCAL leStatus As Long
thisform.oAntView.navigateSync("https://antwise.com/demo/SimpleCheckboxExample.html",lbIsSuccess,leStatus)
thisform.oAntViewDocument.SetElementAttributeById("auto","checked","")
The code above will add an attribute "checked" to a input element of type "checkbox" and as such it puts a tick in the checkbox object.
There's also a synchronous alternative SetElementAttributeByIdSync that wraps the method and event into one call and gives you the ability to check the result immediately after executing the method.
See also: RequestElementAttributeById, SetInputCheckboxById
Introduced in AntView release 1.1.330
AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/25/2024