dojo / widget-core

:rocket: Dojo 2 - widget authoring system.
http://dojo.io
Other
34 stars 39 forks source link

[QUESTION] Add data-attribute to simple div #925

Closed vogloblinsky closed 6 years ago

vogloblinsky commented 6 years ago

How can i simply create this with dojo2 ?

<button data-value="10">Load 10</button>

I am creating my button like that.

v('button', {
    onclick: this.handleLoad
}, ['Load 10'])

Thanks

agubler commented 6 years ago

Adding an attribute like data-value would look something like this:

v('button', { 'data-value': '10' }, [ 'Load 10' ]);

and can be seen in this codesandbox.io

vogloblinsky commented 6 years ago

Thanks works fine.

May be a dedicated section in the documentation could be fine.