Javascript 单击内部图像上的事件触发

Javascript 单击内部图像上的事件触发,javascript,jquery,html,Javascript,Jquery,Html,我在点击事件中有一个小问题。我有一个div,当我点击一个图像时,两个图像标签就在那里,它也会触发内部图像。 这是代码。 HTML代码 <div id="mainContent"> //some other code goes here.. <img id="playId_1" src="img/new/startImgs/menuImgs/play-btn1.png" style="z-index: 2; display: none; position: fixed;" /

我在点击事件中有一个小问题。我有一个div,当我点击一个图像时,两个图像标签就在那里,它也会触发内部图像。 这是代码。 HTML代码

<div id="mainContent">
 //some other code goes here..
 <img id="playId_1" src="img/new/startImgs/menuImgs/play-btn1.png"
style="z-index: 2; display: none; position: fixed;" />
  <img id="levelBg" src="img/new/startImgs/menuImgs/levelBg.png"
style="z-index: 1; display: none; position: fixed;">
 //some other code goes here..
</div>
当我单击play按钮时,它的levelBg事件也会在执行startGame0方法后显示单击alert
请任何人帮助我解决此问题。

将touchstart更改为单击或禁用vesa。

levelBg在哪里..?如果playId_1是隐藏的,你怎么能单击它?@RajaprabhuAravindasamy请检查我现在已编辑了代码。@FelixKling我将在需要时添加display=block,它不隐藏,无法复制:图像大小相同
$('#playId_1').on('touchstart', function(e) {
  startGame();
  e.stopImmediatePropagation();
});

$('#levelBg').on('click', function (e) {
           alert("clicked");
 });