如何触发输入字段中的事件?

时间:2018-07-17 11:31:48

标签: jquery bpmn.io

我正在尝试使用jquery更新输入参数-Name中的值:

import torch

M_onehot = torch.cuda.FloatTensor(C, H, W)
M_onehot.zero_()
M_onehot.scatter_(1, M, 1)

这是有效的更改值,但不能反映在所有字段中。

在快乐的senario中,当更新使用键盘时,该值将反映在所有字段中。

快乐场景用户输入以下名称:

enter image description here

但是使用jquery时,输入字段已更新,但并非所有字段都反映了此更改: enter image description here

enter image description here

我尝试使用以下命令,但不起作用:

P

2 个答案:

答案 0 :(得分:0)

您可以这样做:

$("#yourfield").on("keyup", function() {
  var val = $(this).val();
  $(".yourfield2").text(val);
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>

<p>You have to have an ID or a Class (if you want to populate on multiple spots) everywhere you want to change the text</p>
<input type="text" name="yourfield" id="yourfield"><br>
<p class="yourfield2">Your Text will be display here</p>
<p class="yourfield2">and here</p>

希望您能理解我的意思,并且可以在您的项目中使用它!

答案 1 :(得分:0)

evt = new MouseEvent(('change'), {
    view: window,
    bubbles: true,
    cancelable: true
  });

document.getElementByID('camunda-parameterName"').dispatchEvent(evt);
相关问题