Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/437.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/79.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 模拟单击或按Enter键_Javascript_Html - Fatal编程技术网

Javascript 模拟单击或按Enter键

Javascript 模拟单击或按Enter键,javascript,html,Javascript,Html,我的一个Java脚本有问题。我使用的代码是$'select[name=groupid]'。val'Crew Group'。更改'selectgroupid';从下拉菜单中选择,但除非单击它,否则不会更改页面上的某些变量和值。我如何模拟点击它或其他东西?有人说要更改,但使用$'select[name=groupid].val'Crew Group.change不起作用;要么 有什么想法吗?如果可能的话,我会假设模拟点击或进入会起作用 这就是我看到的变化,如果用anthing试试。触发“变化” 您对

我的一个Java脚本有问题。我使用的代码是$'select[name=groupid]'。val'Crew Group'。更改'selectgroupid';从下拉菜单中选择,但除非单击它,否则不会更改页面上的某些变量和值。我如何模拟点击它或其他东西?有人说要更改,但使用$'select[name=groupid].val'Crew Group.change不起作用;要么

有什么想法吗?如果可能的话,我会假设模拟点击或进入会起作用

这就是我看到的变化,如果用anthing试试。触发“变化”


您对某人如何更改选定项有何怀疑?我总是单击或使用enter键在选择框中选择一些内容,我试图用javascript自动化一个站点。因此,当我选择下拉列表时,只有单击它才会确认。更改事件处理程序是如何绑定到该元素的?@sonicboom Minified code绝对没有用;我们需要一种可读的格式。@AnthonyGrist您建议我把它放在哪里?很漂亮long@sonicboom我想并不是所有这些都与这个问题相关,所以首先要把它缩减到代码中实际相关的部分。然后把这些编辑成这个问题。让我看看是否能找到一些。我相信这可能是相关的,里面有什么有用的吗?
$('select[name="groupid"]').val('Crew Group').trigger('change');