Set HTML attribute
The Set HTML attribute configuration enables you to modify the value of any HTML attribute of an element.
How It works
Select element: Start by choosing the element in the element panel to which you wish to apply this configuration.
Setting up: Navigate to the right panel, in the properties section select the Set HTML attribute configuration.
Specify the attribute key: Input the name of the HTML attribute you intend to modify (for example,
src
,href
, etc.).Define the value: Use the
Function Editor
to specify the new value for the attribute. You can incorporate any data available in Wized, such as variables, cookies, request responses, or any other value.Add conditions (optional): If desired, you can include a condition in the
Function Editor
to modify the attribute only under specific circumstances.
Examples
Change a product image:
Attribute:
src
value:
javascriptreturn r.getProduct.data.imageUrl; // Retrieves the image URL from the API response
Update a Button link:
Attribute:
href
value:
javascriptreturn v.destinationPage; // Provides the URL stored in a variable
Enable or disable an input:
Attribute:
disabled
value:
javascriptreturn !v.formularioValido; // Disables the input if the form is invalid