3

I need to translated the following JQuery code to Dart:

$("#writepad").jqte();

I 've tried the following but didn't succeed:

var jquery = new JsObject(context['window.jQuery("#writepad")']);
jquery.callMethod('jqte');

I'm trying this hoping that it may stop jqte from displaying dynamically generated buttons twice. Your help is highly appreciated. Thank you.

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
Nawaf Alsulami
  • 699
  • 1
  • 8
  • 15

1 Answers1

3

With dart:js :

context.callMethod(r'$', ['#writepad']).callMethod('jqte');

context can be seen as an alias for js window.

Alexandre Ardhuin
  • 71,959
  • 15
  • 151
  • 132
  • Alexandre. Thank you for your response. DartEditor issues a warning about the dollar sign. It says: "Multiple markers at this line - Undefined name '' - Expected an identifier". I escaped $ and replaced $ with 'window.jQuery' but still it does not do what the JS equivalent does. – Nawaf Alsulami Dec 15 '13 at 15:53
  • Ooops, I forgot to escape `$`. Fixed. – Alexandre Ardhuin Dec 15 '13 at 16:35
  • Thank you. Your code works. This answers my question. But I think I found a bug in dart where dart2js code interferes with dart code. Thank you again for your help. – Nawaf Alsulami Dec 15 '13 at 17:11