Contents - Index - Top


SetElementAttributeByName

Interface AntViewDocument

 

Type: Method

Parameters: String Name 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 Name.

Note that the Name is case sensitive and must match the case of the html element.

The attribute is passed via parameter AttrName.

 

This triggers the OnSetElementAttributeByName event on completion as it is an asynchronous operation.

 

Note that multiple elements can match the name passed. If this is the case then only the first element that matches the name will be set.

 

Example in Visual FoxPro:

LOCAL lbIsSuccess

LOCAL leStatus As Long

LOCAL leError As Integer

 

thisform.oAntView.navigateSync("https://antwise.com/demo/SimpleCheckboxExample.html",lbIsSuccess,leStatus)

leError = thisform.oAntViewDocument.SetElementAttributeByName("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 SetElementAttributeByNameSync that wraps the property and event into one call. This gives you the possibility to immediately check the result after executing the method.

 

See also: RequestElementAttributeByName, SetInputCheckboxByName

 

Introduced in AntView release 1.1.330

 


AntView - The MS Edge WebView2 ActiveX control Date last changed: 09/30/2024