Get Element Attribute
Last updated
Last updated
Get Element Attribute
is an output block that allows you to retrieve the value of any HTML attribute in elements on a page or form. The output is of type text and is compatible with Value Parameters of type text or of type any.
Refer to the Get Element Attribute in Data Design block for dynamically generated content.
The block comes in two modes which are discussed below.
The Mode 1 version of the Get Element Attribute block consists of (from left to right):
Attribute: Input configuration setting to specify the HTML attribute to retrieve the value of.
Element: Selectable Input to choose the element you want to get the attribute of.
The Mode 2 version of the Get Element Attribute block consists of (from left to right):
Attribute: Value Parameter that accepts a text value representing the HTML attribute to set or change the value of.
Element: Value Parameter that accepts either a text value in the form of a CSS Selector or an element value. The Element block comes pre-attached for your convenience but can be removed and customized.
The image below shows an example of the Mode 1 version where the variable a is set to the value of the href attribute of a Link element.
In the next example we see a Mode 2 version where the variable a is set to the value of the href attribute of the same Link element. This time the element is selected using a CSS Selector.