Set Element Attribute
Last updated
Last updated
Set Element Attribute
is a regular block that allows you to set the value of any HTML attribute in elements on a page or form.
Refer to the Set 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 Set Element Attribute block consists of (from left to right):
Attribute: Input configuration setting to specify the HTML attribute to set or change the value of.
Element: Selectable Input to choose the element you want to set the attribute of.
Data: Value Parameter that accepts the value for the attribute being set (of type text)
The Mode 2 version of the Set 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.
Data: Value Parameter that accepts the value for the attribute being set (of type text)
The image below shows an example of the Mode 1 version where a Link element is selected for which the Attribute input configuration is set to href and the Data value parameter is attached to a Text block containing the Zingy website URL.
In the next example we see a Mode 2 version where the Element value parameter is attached to a Text block containing a CSS Selector that selects the same Link element and sets the same attribute: href. This time the Data value parameter is attached to a Variable block for variable named a.
NOTE: Using a CSS selector, you can operate on multiple elements that match the criteria specified by the selector. See the references below for more information: