我正在使用代码动态创建一些html元素,例如
new ButtonElement()而且很容易添加这样的类
..classes.add('dropdown-menu')我想在其中添加以下html
data-toggle="dropdown"但飞镖不允许我这么做。如果我添加了一个类似的new ElementHtml
new ElementHtml('<button data-toggle="dropdown"></button>')上面说是无效的。我需要它作为我的bootjack下拉选择器。
对此有什么想法吗?
发布于 2014-10-09 15:25:45
我认为您需要一个启用了NodeValidator属性的data-toggle (参见Dart, why does using innerHtml to set shadow root content work but appendHtml doesn't?)。
没有NodeValidator,你可以做的是
new ButtonElement()..dataset['toggle'] = 'dropdown';https://stackoverflow.com/questions/26282202
复制相似问题