-
Notifications
You must be signed in to change notification settings - Fork 16
Dom.SetAttribute
boxgaming edited this page Jul 12, 2026
·
2 revisions
Sets the value of an HTML DOM element's attribute by name.
Available in release 0.11.0
Dom.SetAttribute e, attributeName, attributeValue
- The e parameter specifies the DOM element on which the operation will be applied.
- The attributeName parameter specifies the name of the attribute which will be set.
- The attributeName parameter specifies the new value for the attribute.
Import Dom From "lib/web/dom.bas"
Dim As Object div, img
div = Dom.Create("div")
div.innerHTML = "<img id='test-image' src='logo.png' height='300' width='400' data-payload='test data'>"
img = Dom.Get("test-image")
Dim As Object attr
Dom.SetAttribute img, "height", "350"
Dom.SetAttribute img, "data-payload", "new data value"
Print Dom.GetAttribute(img, "data-payload")new data value
Dom.GetAttribute
Dom.GetAttributeNames
JavaScript element.setAttribute()