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'
    } 
}
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With