hyTags
HomeHome DocumentationDocumentation

attribute-get

Gets the value of an attribute on an element
Parameter
Type
Description
name
String
The name of the attribute to get
return
string
The value of the attribute, or nil if the attribute does not exist
Test Case:Get existing attribute
    <div id="test-id"></div>
    
    <attribute-get name="id">
    <assert-equal value="test-id" type="string">
    
    👆 Try to change something!
  • Test Case:Get non-existing attribute returns nil
      <div></div>
      
      <attribute-get name="missing">
      <value-is-nil>
      <assert-true>
      
      👆 Try to change something!
    • Test succeeded Test failed