HtmlElement.GetAttribute Method

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets the value of the specified attribute on the current HTML element.

Namespace:  System.Windows.Browser
Assembly:  System.Windows.Browser (in System.Windows.Browser.dll)

Syntax

'Declaration
Public Function GetAttribute ( _
    name As String _
) As String
public string GetAttribute(
    string name
)

Parameters

Return Value

Type: System.String
An attribute on the current HTML element.

Exceptions

Exception Condition
ArgumentException

name is an empty string.

ArgumentNullException

name is nulla null reference (Nothing in Visual Basic).

Remarks

If the specified attribute does not exist on the current HTML element, this method returns nulla null reference (Nothing in Visual Basic).

Version Information

Silverlight

Supported in: 5, 4, 3

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.