This is a typical situation in jQuery:
$(".myClass").myFunction({
aKey: 'some value'
});
How do you call that using dart:js?
The documentation is a bit cryptic and a similar question that I found here seems dated.
This is a typical situation in jQuery:
$(".myClass").myFunction({
aKey: 'some value'
});
How do you call that using dart:js?
The documentation is a bit cryptic and a similar question that I found here seems dated.
You can do :
main() {
js.context.callMethod(r'$', ['.myClass'])
.callMethod('myFunction', [new js.JsObject.jsify({'aKey': 'some value'})]);
}
You can use the build-in funcitons querySelector or querySelectorAll instead of the jQuery selector. So it would be:
main(){
querySelector(".myClass").myFunction(){
aKey: 'some value'
}
}
or for mulitple elements:
main(){
querySelectorAll(".myClass").myFunction(){
aKey: 'some value'
}
}
How about use DQuery instead.
DQuery is a porting of jQuery in Dart.