简体   繁体   English

如何从ember中的输入助手上的事件获取event.target

[英]How to get an event.target from event on input helper in ember

iam using input helper in ember for binding attributes value iam在ember中使用输入助手来绑定属性值

<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. 我只想将事件对象从key-press = onKeyPressShowPanel传递给控制器​​,以便可以使用event.target通过jquery片段操纵某些元素。 this is my onKeyPressShowPanel action in controller 这是我在控制器中的onKeyPressShowPanel操作

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

unfortunately the event that i pass is a value that come from value = alamat. 不幸的是,我传递的事件是来自value = alamat的值。 how to get an event.target from event on input helper so i can manipulate some element using jquery. 如何从输入助手上的事件获取event.target,以便我可以使用jquery操纵某些元素。 Any answers would be helpfull for me.. thank you :) 任何答案将对我有帮助..谢谢:)

You can try the below code to get jquery.Event object, 您可以尝试以下代码来获取jquery.Event对象,

{{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 manipulate some element using jquery -一般情况下不好,但这取决于您的情况

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM