jQuery1.x 选择器点击功能在 Internet Explorer 中不起作用

jQuery1.x selector click function not working in Internet Explorer

<img style="cursor:pointer" class="optStyle" 
src="/ekp/resource/style/default/icons/add.gif" title="添加行" 
onclick="DocList_AddRow();XFom_RestValidationElements();">

我正在使用jQuery1.x选择器获取元素,然后使用它的点击功能来制作它,但在Internet Explorer中不起作用,Chrome就可以了。

$( "img[title='添加行']").click()

这里是效果图link(我没有10声望所以不能post图) https://img.shownmmp.top/my.gif 我已经在 ie console (f12) 中尝试了 jquery1.x,但它什么也没做。我在Chrome做了,效果很好,我现在该怎么办?

我想让点击功能在ie中工作。 您还可以告诉我如何使用 javascript 或 jquery 来点击 img 元素吗?谢谢

我尝试用下面的代码进行测试,发现它在 IE 11 和 chrome 上运行良好。

<!DOCTYPE html>
<html>
<head>
 <meta charset="utf-8">
<script src="https://code.jquery.com/jquery-1.10.2.js"></script>

<script>
$(document).ready(function(){
  $("#clk").click(function(){
   $( "img[title='添加行']").click();
  });
 
});

function abc()
{
alert("abc");
}
function xyz()
{
alert("xyz");
}
</script>
</head>
<body>



<button id="clk">click</button>

<img style="cursor:pointer" class="optStyle" 
src="C:\Users\Administrator\Desktop\plex-icon.png" title="添加行" 
onclick="abc();xyz();">
</body>
</html>

在 IE 11 中的输出:

您可以尝试用您身边的这段代码进行测试,让我们知道它是否有效。