mardi 20 juin 2017

How to get the element reference "this" in EmberJS events?

I want to access the target element in the called method in onchange. I have the following code:

Template

<select class="form-control" data-abc="1" onchange= >
  <option value="">Select</option>
  .
  .
  .
</select>

Component

export default Ember.Component.extend({
    actions: {
      someMethod(value) {
        jQuery(this).data("abc"); // <-- Want to access element here
      }
    }
});

But, this doesn't work.




Aucun commentaire:

Enregistrer un commentaire