Try using formatString or customString widgets with context. You can print out any html that way.
Adding custom attributes to Mendix generated html objects might be possible only with javascript after render of objects.
Hi,
There is marketplace widget/snippet available, using that you can add a piece of HTML or JavaScript to a form.
Here is the link:
https://marketplace.mendix.com/link/component/56
You can add this widget on page, like below
Hope this helps you!