mardi 31 juillet 2018

Ember jQuery "one" event handler getting called more than once

In my Ember app, I have some jQuery code to execute (based on paste to an input box)

My question is I have used "one" in my code, but it is getting executed more than once. As per jQuery docs, it should be invoked only once.

didRender: function() {
    var self = this;
    var $inputs = Ember.$("input[id*=my-field]");

    $inputs.on("paste", function() {
        var $this = Ember.$(this);
        var originalValue = $this.val();
        $this.val("");

        $this.one("input", function() {
            // Why is this getting invoked more than once ?
            // Contains code which splits & sets value to multiple textboxes like 
//$inputBox.val('SPLITTED_PASTED_VALUE');
        });
    });
}




Aucun commentaire:

Enregistrer un commentaire