0

iam using input helper in ember for binding attributes value

<div class="form-group profile-desa-component-form-group">
          <label class="col-sm-4 control-label">{{t 'field.alamat'}}</label>
          <div class="col-sm-8 no-padding">
            {{#if editMode}}
              {{input class="form-control editonly btn-no-corner" key-press="onKeyPressShowPanel" type="text" value=alamat}} <- this is my input helper
            {{else}}
              <input readonly class="form-control btn-no-corner readonly" type="text" value={{alamat}}>
            {{/if}}
          </div>
          {{backend/pop-up-form title="Isikan alamat lengkap kantor desa dan kelurahan"}}
        </div>

i just want to pass an event object from key-press = onKeyPressShowPanel to the controller so i can use event.target to manipulate some element via jquery snipet. this is my onKeyPressShowPanel action in controller

onKeyPressShowPanel(event){
      this.debug(event);
    },

unfortunately the event that i pass is a value that come from value = alamat. how to get an event.target from event on input helper so i can manipulate some element using jquery. Any answers would be helpfull for me.. thank you :)

cahyowhy
  • 553
  • 2
  • 9
  • 26

1 Answers1

0

You can try the below code to get jquery.Event object,

{{input class="form-control editonly btn-no-corner" keyPress=(action "onKeyPressShowPanel") type="text" value=alamat}}

manipulate some element using jquery -Generally is not good but it depends on your case

Ember Freak
  • 12,918
  • 4
  • 24
  • 54
  • check this [twiddle](https://ember-twiddle.com/43bf27e3a7129cc0e81cbb70a2d6772d?openFiles=templates.application.hbs%2C) not the difference `keyPress` instead of `key-press`. please provide non working twiddle. i will chec it out – Ember Freak May 22 '17 at 10:57