I am working with dart and have something like this in my html file:
<button doStuff="alert('test')"></button>
And I want to do something like dart:
myButton.doStuff();
How would I do this. The code must be with HTML Tag, preferably . I do not want to create any custom or third party UI elements like polymer.
Thanks :)
edit:
The problem has changed, sorry, this is how I want to do:
//javascript code in the head of html
var htmlTag = getElementById('htmlTag');
htmlTag.doStuff(function() {
alert('test');
});
<!-- HTML code/ doStuff method not mentioned in the tag anymore -->
<h1 id="htmlTag">
//dart code to call method doStuff
querySelector('#htmlTag')..doStuff();
How can I call doStuff() method from dart with the given element button1. Thanks
edit 2: I changed the html tag, because the button confused some people
clickevent and pass a callback that gets executed when theclickevent occurs. To make yourgetElementById('button1')to work you should add the id to the button<button id='button1'>text</button>evaland therefore can't execute arbitrary strings as code. It would help a lot if you could explain what purpose this construct should fulfill.